Wednesday, 7 August 2013

Is it possible to make helper only for path?

Is it possible to make helper only for path?

Assuming I have the code below
<%= link_to "Test", foo_path(:mode => function) %>
Then I'd like to have something like this instead. Is it possible??
<%= link_to "Test", path_helper(function) %>
application_helper
def path_helper(function)
if function=1
foo_path(:mode => 1)
else
foo_path
end
end

No comments:

Post a Comment