Displaying 1 result from an estimated 1 matches for "current_id_select".
2006 Feb 16
0
RE: Applying list-item format depending on action (Diego Scataglini)
...If it happens only once or twice in your whole application, that''s just
fine.
If it happens more than that and in multiple controllers/views then maybe
you want to create a helper for it.
Something like this: (didn''t test it, but should be working)
module ApplicationHelper
def current_id_select(controller, action)
( (params[:controller] == controller) and (params[:action] == action) ) ?
'' id="current"'' : ''''
end
end
Then in the view you just go
<li <%= current_id_select(''admin'', ''list'') %>>...