I'm trying to set default scope according to some criteria determined by ana ActionController before_filter. In controller:
before_filter :authorize
...
def authorize
if some_condition
@default_scope_conditions = something
elsif another_condition
@default_scope_conditions = something_else
end
end
Inside the ActiveRecord
default_scope :conditions => @default_scope_conditions
But it doesn't seem to work, the before filter gets called but the default_scope doesn't get set. Could you please advise me what I'm doing wrong and how to fix it or suggest me some other way of achieving that.