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.

Grant Rodgers's latest activity

Saturday, February 16 2008
106 extend Ambition to ActiveRecord associations was updated in Plugins
  • Grant Rodgers
    Grant Rodgers commented at 5:01 PM

    Pretty simple really, I just replaced the contents of the define_method block in collection_reader_method with

    reflection.klass.query_context.select { |entity...

Friday, February 15 2008
106 extend Ambition to ActiveRecord associations was updated in Plugins
  • Grant Rodgers
    Grant Rodgers commented at 7:53 PM

    ActiveRecord associations already support Enumerable methods, but they're useless in large scale apps because the entire collection is loaded, and you could ha...

Tuesday, November 13 2007
156 [PATCH] Collection.create should handle nil page was updated in Plugins
  • Grant Rodgers
    Grant Rodgers created the ticket at 5:04 PM

    (sorry, sql is oracle)

    The paginate finder handles a nil value for page:

    Company.paginate(:page => nil, :per_page => 10)
    => select * from (select raw_sql_.*...
Friday, September 21 2007
105 add scoped finders was updated in Plugins
  • Grant Rodgers
    Grant Rodgers commented at 12:06 PM

    Yep, that occurred to me. Certainly a matter of taste which you prefer.

    I think it might be a bit better encapsulated as a special method, and maybe faster s...

Thursday, September 20 2007
105 add scoped finders was updated in Plugins
  • Grant Rodgers
    Grant Rodgers commented at 6:47 PM

    Not sure how add-ons are packaged, unfortunately - let me know if there's something else to be done.

  • Grant Rodgers
    Grant Rodgers commented at 6:46 PM

    works like this:

    class User < ActiveRecord::Base
      scoped_context :admins do |context|
        context.select { |u| u.type == 'Admin' }
      end
    end
    
    User.admi...
  • Grant Rodgers
    Grant Rodgers commented at 6:40 PM

    went ahead and wrote this. Rather small amount of code.

Thursday, September 06 2007
106 extend Ambition to ActiveRecord associations was updated in Plugins
  • Grant Rodgers
    Grant Rodgers created the ticket at 5:07 PM

    Seems like a natural addition: add all the goodness from ActiveRecord classes to associations!

    We have this kind of stuff all over our app:

    current_user.answ...

105 add scoped finders was updated in Plugins