Parameters passed into a before_filter method call?
ruby-on-rails, ruby-on-rails-4
Solution
There isn't a way to pass parameters to a request callback when you define it using a symbol. You can instead use a block:
before_filter(only: [:index, :show]) { authorize('You forgot to login') }
Problem
In my `application_contorller` I have the method: ``` def authorize(message = "Please Login") if current_user.nil? redirect_to :root, alert: message return end end ``` And I want to be able to put a custom message in if needed so that I can call this method from many different controllers in a `before_filter`. For example in another controller I have: ``` before_filter :authorize, except: [:index,:show] ``` How can I pass the `message` param into the `:authorize` method call in the `before_filter` in order to show a different message?