How can I get the controller action or url that the page is going to land on? (not the one it's coming from)
e.g if i click new_event_path
, can I know extract either of those?
Trying to implement a helper method for this
Rails bootstrap nav tabs active while rendering via yield
For example in my view I have this class=<%= path_set_active(['upcoming', 'past']) %>
and in my helper method i have this
def path_set_active(array)
'active' if (array).include?(controller.action_name)
# binding.pry
end
This doesn't work because controller.action_name
is not hit yet. If i do binding.pry it's saying it's coming from home
. But it's going to hit the upcoming
action. So how do i detect where the the request/controller is going?