Reputation: 3
I have this method in application_helper
def is_controller?(*args)
"active" if args.include?(params[:controller])
end
This works.
%= is_controller?("x") %>
This is not working.
%= is_controller?("x", "y", "z", "t") %>
Any help will be appreciated.
Upvotes: 0
Views: 182
Reputation: 3234
In the console it behaves as you expect
irb(main):020:0> def is_controller?(*args)
irb(main):021:1> "active" if args.include?("x")
irb(main):022:1> end
=> nil
irb(main):023:0> is_controller?("x")
=> "active"
irb(main):024:0> is_controller?("y")
=> nil
irb(main):025:0> is_controller?("x","y")
=> "active"
so the problem would seem to be that your params[:controller] value is not what you think it should be ...
Upvotes: 1