Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Ryan Bates's latest activity

Tuesday, July 20 2010
57 :through option for "named_scope" was updated in Ruby on Rails
  • Ryan Bates
    Ryan Bates commented at 5:05 PM

    Neeraj, In Rails 3 you can just call the scope directly.

    class User < ActiveRecord::Base
      named_scope :billable_by, lambda{|user| {:conditions => {:billable_i...
Sunday, April 11 2010
57 :through option for "named_scope" was updated in Ruby on Rails
  • Ryan Bates
    Ryan Bates commented at 5:17 AM

    This is possible with the new Active Record query syntax added in Rails 3.

    scope :visible, where(:hidden => false)
    scope :available, visible.where(:discontinue...
Saturday, April 10 2010
4363 fields_for not working outside ERB was updated in Ruby on Rails
  • Ryan Bates
    Ryan Bates commented at 7:09 PM

    Here's a patch with passing test.

  • Ryan Bates
    Ryan Bates created the ticket at 6:31 PM

    If one calls fields_for in a helper method, then the block result is not returned by the method. For example.

    # application_helper.rb
    def foobar
      fields_for(:...
Monday, March 23 2009
1484 Deprecate error_messages_for was updated in Ruby on Rails
  • Ryan Bates
    Ryan Bates commented at 3:26 PM

    I missed the discussion on #rails-contrib so it's hard to see the primary motivation behind this ticket. Can you go into detail on what is being accomplished he...

Friday, February 06 2009
1892 nested attributes should not have meaningful hash keys was updated in Ruby on Rails
  • Ryan Bates
    Ryan Bates commented at 4:16 PM

    Oops, I meant to say I'm okay with supporting both approaches 1 & 4 where the nested attributes could either be given as an array or a hash. If it's a hash, the...

  • Ryan Bates
    Ryan Bates commented at 4:13 PM

    I much prefer to use a hash with unique keys when passing nested attributes through a form. Here are a few reasons.

    • the id and name of each form field element ...
Friday, January 09 2009
1202 Add attributes writer method for an association. was updated in Ruby on Rails
  • Ryan Bates
    Ryan Bates commented at 4:40 PM

    I know I'm late to the party, but I'd like to test and help contribute to the next patch if it's okay. Eloy, do you think we can communicate over email? ryan AT...

Friday, December 05 2008
1516 Average, Maximum, Minimum on associations should return 0 when no rows are re... was updated in Ruby on Rails
  • Ryan Bates
    Ryan Bates commented at 10:17 PM

    @Shane, I'm okay with average returning zero. It's mainly min/max that I have a problem with. I think Anthony explained it well. Zero plays no part in the min/m...

  • Ryan Bates
    Ryan Bates commented at 5:18 PM

    -1, I think it should behave like the existing enumerable methods. Calling [].min or [].max returns nil in Ruby. Calling [].sum returns zero in ActiveSupport. T...