anaActionControllerbefore_filterによって決定されたいくつかの基準に従ってデフォルトのスコープを設定しようとしています。コントローラー内:
before_filter :authorize
...
def authorize
if some_condition
@default_scope_conditions = something
elsif another_condition
@default_scope_conditions = something_else
end
end
ActiveRecordの内部
default_scope :conditions => @default_scope_conditions
しかし、それは機能していないようです。beforeフィルターが呼び出されますが、default_scopeは設定されません。私が間違っていることとそれを修正する方法を教えてください。またはそれを達成するための他の方法を提案してください。