-
Notifications
You must be signed in to change notification settings - Fork 35
trouble generating active subtab for "show" action #44
Copy link
Copy link
Open
Description
I'm trying to generate subtabs dynamically. In this case, I have a limited number of Floors, and I would like to create a subtab pointing to the "show" action of the "maps" controller for each one of them.
I can successfully generate the subtabs like this:
Floor.all.each do |floor|
send("floor_map_#{floor.id}_subtab") do
text { "Floor #{floor.id}" }
link_path { map_path(floor) }
visible_when { true }
enabled_when { true }
active_when { (floor.id == @floor) and in_action('show').of_controller('maps') }
end
end but I can't successfully make the proper one active. I have set the @floor variable in the controller, but it doesn't seem to be set (or it is otherwise not available) when active_when is called.
My ( floor.id == @floor ) test works correctly in the enabled_when and visible_when blocks, but not in active_when. Since the parent tab is set to "active_when { a_subtab_is_active }" I really do need to make the proper tab active.
Any ideas?
Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels