Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add before_filter method to the end of the list in rails 3

I have before_filter :method in my application_controller and I want this method to run after the before_filter methods in inherit class.

how can I do it?

example

class ApplicationController < ActionController::Base
  protect_from_forgery

  before_filter :run_second
end

class SessionsController < ApplicationController
  before_filter :run_first
end
like image 626
gilsilas Avatar asked Jun 18 '11 22:06

gilsilas


1 Answers

I think the most Rails-friendly way of doing this would be to use prepend_before_filter in your SessionsController:

class SessionsController < ApplicationController
  prepend_before_filter :run_first
end
like image 74
coreyward Avatar answered Oct 01 '22 01:10

coreyward