Suppose I have the following then in my view -- I am creating a form
for the model 'Lead' and there is a field lead.associate_id. In my
controller, I am setting a variable to a model @Up, and @Up has an
associate_id also. I would like the default lead.associate_id be set
in my select with the @Up.associate_id. Please note the second line in
my view code below (which does not work, of course). How can I default
the lead.associate_id on this form to create a new lead to be equal to
the @Up.associate_id ?
<% form_for :leads, :url => { :controller => 'channels', :action =>
"lead" }, :html => {:name => 'leadform'} do |f| %>
<% lead.associate_id = @Up.associate_id %>
<%= select("lead", "associate_id", Associate.find(:all, :order =>
'associates.lastname ASC', :conditions => ['deleted=0']).collect {|p|
[ p.to_s, p.id ]}, {:include_blank => ''}) %>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---