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.

Adam Wróbel's latest activity

Thursday, March 17 2011
1812 default_scope can't take procs was updated in Ruby on Rails
  • Adam Wróbel
    Adam Wróbel commented at 1:17 PM

    I've started a discussion on core with suggestion to change scope syntax. I think the syntax change is certainly a better way of resolving this issue than a hac...

Thursday, February 03 2011
6290 [PATCH] except doesn't work in different scopes was updated in Ruby on Rails
  • Adam Wróbel
    Adam Wróbel commented at 12:22 AM

    I know you specify multiple columns for order, but when I referred to multi and single values I meant values that get merged and values that get overwritten. My...

  • Adam Wróbel
    Adam Wróbel commented at 12:05 AM

    An alternative would be to overwrite on merge, but append on order(). That would be similar to where(:column => value). Multiple where() calls create OR but dur...

Wednesday, February 02 2011
6290 [PATCH] except doesn't work in different scopes was updated in Ruby on Rails
  • Adam Wróbel
    Adam Wróbel commented at 11:27 PM

    I suggest moving order from MULTI_VALUE_METHODS to SINGLE_VALUE_METHODS and overwriting the order array with each merged scope or new call to order(). There's n...

Monday, January 31 2011
1812 default_scope can't take procs was updated in Ruby on Rails
  • Adam Wróbel
    • Tag changed from rails 3.1 to rails 3.1, default_scope, named_scope, patch
    by Adam Wróbel at 6:07 AM

    This problem can also surface when using named scopes.

    class Widget < ActiveRecord::Base
      default_scope lambda { where(['created_at >= ?', 10.minute.ago]) }
     ...
Saturday, January 29 2011
1812 default_scope can't take procs was updated in Ruby on Rails
  • Adam Wróbel
    Adam Wróbel commented at 2:05 PM

    Thanks for finding this issue.

    You're right that those latter calls calculate previously defined lambdas and append their results to the final query. A test wit...

Tuesday, January 25 2011
6297 [PATCH] Default scopes can't be merged with something that responds_to call was updated in Ruby on Rails
  • Adam Wróbel
    Adam Wróbel commented at 2:07 PM

    It's currently waiting to be reviewed by Aaron and hopefully merged into edge for a release in 3.1. And yes - that code allows one to call default_scope multipl...

  • Adam Wróbel
    Adam Wróbel commented at 1:39 PM

    There is an open ticket to enable proc handling for default scope. It contains a patch that enables lambda default scopes instead of raising an exception on rec...

Saturday, January 22 2011
1812 default_scope can't take procs was updated in Ruby on Rails
  • Adam Wróbel
    Adam Wróbel commented at 4:24 PM

    This is unrelated to the lambda support. Uniqueness validator just ignores the default_scope regardless of whether it's lambda or arel finder.

    activerecord/lib...

Thursday, January 20 2011
1812 default_scope can't take procs was updated in Ruby on Rails
  • Adam Wróbel
    Adam Wróbel commented at 5:27 PM

    I was reminded to use respond_to?(:call) instead of kind_of?(Proc) on github. Here's a corrected patch.