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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 16, '12 at 10:22a
activeFeb 16, '12 at 10:22a
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Dave: 1 post

People

Translate

site design / logo © 2022 Grokbase