RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Submit a post

You can use basic HTML markup (e.g. <a>) or Markdown.
Note that your post may be edited to suit the format of the site.

As you are not logged in, you will be
directed via GitHub to signup or sign in

Post Preview

Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.

Mongoid (MongoDB) has_many/belongs_to relation and wrong index being picked

If you have issues with your Mongoid relations and wrong indexes being picked, you may want to look here: Mongoid (MongoDB) has_many/belongs_to relation and wrong index being picked.

Link broken since it thinks your href is a relative one
@PIKACHUEXE: Already fixed :)

Recalculate counter cache columns in Rails

Rails has this great feature called counter_cache. When you have a has_many/belongs_to relationship between two models, it basically lets you say that you want to save the number of associated objects on the has_many side. So if you have Post has many Comments, you can do post#size and no SQL query is executed, Rails simply just looks at the comments_count field of the post. Read more

Spyke: A pretty good, full-featured ORM for API-backed apps

Extracted from an API-backed Rails app currently running in production, Spyke provides an ActiveRecord-like interface for interacting with REST services. It comes complete with features I was unable to find in other solutions, such as properly working scopes, customizable associations, ActiveRecord-style log output, fast JSON handling, etc. View Spyke on GitHub

The good and bad of paid acquisition

Product people usually stay away from buying traffic to promote products. That’s because they don’t understand how it works, or underestimate how it might help accelerate growth. In this article, I discuss the good and bad of buying traffic to promote digital products, ebooks and apps. After reading this article, you’ll at least get rid of your prejudices against paid acquisition and become more comfortable with the idea of using paid acquisition to get more customers.

Loading older posts