[Rails] polymorphic_url
Hello all.
Looked through "polymorphic_url" method (used by "form_for",
"redirect_to" and other helpers) and observed that is no way to use it
with any of non-resource parameters. I.e if we got
resources :users, :scope => "/:somestring"
in our routes.rb config, that generates user_path(@user, { :somestring
=> "brazil" }) linked to http://site.com/brazil/users/1 it fails i.e.
"form_for @user" and "redirect_to @user", cause it calls method
user_path(@user) without :somestring
and if we write "form_for [{ :somestring => "brazil" }, @user]" it
fails on "build_named_route_call" method, which trying to convert
first Hash to string-part of named route method name.
Of course we have :url option fo "form_for", and we can use user_path
right in "redirect_to" but it seems ugly, and there is no good way
always to edit many lines of scaffolded code.
Any suggestions?
--
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home