I’m asking for thoughts on how to trap valid but not active routes in
route.rb instead of per controller
ie I’m trying to trap the route at the dispatcher level before it
dispatches the request to the specific controller/action method.
Here is the scenario:
A user types in the route in the browser:
eg. http://localhost:3000/events/15
This is a show action on controller events
The controllers are hierarchal as diagramed but the user has not
selected an exhibit:
user
|
→ exhibits
|
→ events
Thus the event is not active and can be viewed as nil.
My current solution is to use a before_filter per controller. This is
specific to the controller context but duplicates the code per
controller. Part of the problem is the the helper functions of the
controllers are not open to the route.rb. though the instance methods/
variables do get exposed when the dispatcher runs the proc of
determined controller/action.
So how would u be able to get at each controller’s instance methods
and implement the DRY code at the dispatcher level before it
dispatches to the found controller/action.
Ideas welcomed.
Thk u
Dave