Ralph Shnelvar wrote:
> Colin Law wrote:
>> I think maybe you cannot include query terms in form_for :url. An
>> alternative is to use hidden fields in the form.
>
> Colin, thank you. You appear to be correct.
>
> So for the next poor person fighting to get internationalization to work
> (I18n. See http://guides.rubyonrails.org/i18n.html Section 2.3 Setting
> and Passing the Locale) ..
>
> form_for cannot be, uh, "internationalized" because the various flavors
> of url_for that I18n hooks will have the locale parameter disappear if a
> form, any form, is used. It appears not to be an ruby/rails/I18n problem
> but an arcane "problem" in html.
>
> Thus ... if you want to pass a couple of extra parameters when using
> form_for ... you can do what I did. I'm pasting in my adlterated code:
>
> - - - - - - -
> <% form_for @countryToSearchFor,
> :url => signed_in_path(:action => "show", :id =>
> 'connected_to_country'),
> :html => {:method => :get} do |f| %>
> <input type="hidden" name="locale" value="<%= params[:locale] %>" >
> <input type="hidden" name="somename" value="someothervalue" >
[...]
Why not store the locale in the session, instead of passing around
hidden fields?
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
Posted via http://www.ruby-forum.com/.
--
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.
No comments:
Post a Comment