RameshVel RameshVel - 6 months ago 28
Ruby Question

Rails 3 way of doing skip_before_filter, :only

In rails 2.8 we can write skip_before_filter like this

skip_before_filter :require_login, :only => [:create,:new,:accept]


which means, i wanted to apply the filter
require_login
only to these actions
[:create,:new,:accept]
, and skip the filter for others.

But it seems, this way is deprecated in rails 3. And new skip_filter is added. i have tried this

skip_filter :require_login, :only => [:create,:new,:accept]


but its not working, so how can i do this in rails 3.

Answer
  • skip_before_filter has not been deprecated, see source.

  • You're using it as expected.

So how did you deduce it's not working properly?