szimek
2010-May-21 19:41 UTC
Extending the routing system - is it possible to output procs inside module_eval?
Hey,
I was thinking about extending Rails routing system to allow to pass
procs as default values for segments e.g.
:path_prefix => "/:locale", :defaults => { :locale =>
Proc.new
{ I18n.locale } }
but after checking the code I''m not really sure if it''s
possible.
The problem is that Rails uses module_eval with string to dynamically
generate named route helper methods like this:
http://gist.github.com/1526bf48b78eee94e6f0
Putting e.g. a proc into options hash causes invalid syntax, because
the hash is simply printed there using options.inspect.
Is there any other way to define these methods *and* allow procs in
options hash?
Cheers,
Szymon
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.