2011-08-09 32 views

回答

1

我不是100%肯定我明白你的问题,但是,例如,当你写一个named_scope你可以通过选择这样的:

named_scope descend_it_by_that_other_column, 
:select => "", 
:joins => "LEFT JOIN ...", 
:conditions => "..." 

另一个例子:

def my_fancy_method_returning_things 
association_name.all :limit => 5, :joins => 'LEFT JOIN ... ON ... = ...', :order => ...' 
end 
+0

啊,我没有想到覆盖命名的范围。我会稍微尝试一下。谢谢。 – NullVoxPopuli

+1

如果你在你的参数中使用了searchlogic并且有类似的东西: “search”=> {“order”=>“ascend_by_rating”}那么searchlogic将会使用名为scope的ascend_by_rating。我希望这有帮助 :) – socjopata