On 1 Mar 2010, at 16:05, LeonS wrote:

> Hi,
> 
> I've got a Form with a select helper, but the value in the database
> doesn't get selected:
> The name of the model is "special_tip" and belongs to a
> special_quest_option and a special_quest
> 
> <% form_for special_tip do |f|%>
>  <%= select("special_tip", "special_quest_option_id",
> special_quest.special_quest_options.all.collect {|sqo| [ sqo.text,
> sqo.id ] },{:include_blank => true}) %>
> <%= f.submit "tip the Special Quest" %>
> <% end %>
> 
> What do I'm doing wrong?
> The correct values are in the select box, but the current doesn't get
> selected.



You're mixing form_for (which doesn't require that you have an instance 
variable containing the object) and the non form builder version of select 
(which does).

f.select("special_quest_option_id", ...) 

should work better

Fred

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to