0

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?

Community
  • 1
  • 1
Clam
  • 935
  • 1
  • 12
  • 24
  • I don't understand how this question is different than your other question you're linking to? I am marking it as a duplicate ... If it really is different, then please explain :-) – Martin Tournoij Dec 12 '14 at 05:11
  • possible duplicate of [Rails bootstrap nav tabs active while rendering via yield](http://stackoverflow.com/questions/27396129/rails-bootstrap-nav-tabs-active-while-rendering-via-yield) – Martin Tournoij Dec 12 '14 at 05:11
  • i'll update the question right now. it's slightly different because i'm stuck on how to call a method which i'm not sure if it exists.. – Clam Dec 12 '14 at 05:14
  • I never found the answer to this but I did solve the issue with the first problem which is now answered. – Clam Dec 17 '14 at 01:11

0 Answers0