Nested has_many :through

Hi (Oh my God… he just started his blog post with ‘Hi’), Did you know that as of Rails 3.1, you can have nested has_many :through clauses in your models? Here is a concrete example to understand what I mean: [ruby] class SportSchedule < ActiveRecord::Base has_many :gamedays has_many :games, :through => :gamedays has_many :results, :through [...]

Continue reading →

How To Strip Insignificant Zeros From a Float In Rails

I had a float attribute in a Rails application and wanted to strip non-significant zeros when displaying it on a page. With the number_with_precision helper from ActionView, that’s a trivial thing:

Continue reading →