Hi everybody! I''m new at ruby on rails, I''m trying to create a view like this: *%= semantic_form_for :routes_status_race, :url => status_race_admin_routes_path do |f| %>* *<p>* * <% contact_array = Contact.all.map {|contact| [contact.name, contact.id]}%>* * <% route_importer_array = RouteImporter.all.map {|importer| [importer.name, importer.id]}%>* * * * <b>Contact: <select size="contact_array.lenght"><%=options_for_select(contact_array)%></b>* * <b>Route Importer: <select size= "route_importer_array.lenght"><%=options_for_select(route_importer_array)%></b> * * * * <p>* * <b>Import(csv): <%= f.file_field :uploaded_data, :size => "20" %></b>* * <b> **<%= submit_tag(''Import'', { :class => "Button" }) %> </b>* * </p> * *</p>* *<% end %>* The problem is that is just showing the first options_for_select, I mean right now I can see in the browser just Contact, but if I change the order and write Route Importer before I just can see Route Importer. The Import(csv) and the button are working right. Any idea that why I just can see the first select option and not both? Thanks in advance! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/RFJDdVzVH7AJ. For more options, visit https://groups.google.com/groups/opt_out.
On 6 November 2012 09:40, Anna <anna-Ps2x7ePzyFHJxEgaCYcSJA@public.gmane.org> wrote:> Hi everybody! I''m new at ruby on rails, I''m trying to create a view like > this: > > %= semantic_form_for :routes_status_race, :url => > status_race_admin_routes_path do |f| %> > <p> > <% contact_array = Contact.all.map {|contact| [contact.name, contact.id]}%> > <% route_importer_array = RouteImporter.all.map {|importer| > [importer.name, importer.id]}%> > > <b>Contact: <select > size="contact_array.lenght"><%=options_for_select(contact_array)%></b> > <b>Route Importer: <select size> "route_importer_array.lenght"><%=options_for_select(route_importer_array)%></b> > > <p> > <b>Import(csv): <%= f.file_field :uploaded_data, :size => "20" %></b> > <b> <%= submit_tag(''Import'', { :class => "Button" }) %> </b> > </p> > </p> > > <% end %> > > The problem is that is just showing the first options_for_select, I mean > right now I can see in the browser just Contact, but if I change the order > and write Route Importer before I just can see Route Importer. The > Import(csv) and the button are working right. Any idea that why I just can > see the first select option and not both? Thanks in advance!Have a look at the generated html in the browser (View > Page Source or similar) and see if it looks ok. Colin> > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/RFJDdVzVH7AJ. > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Anna ha scritto:> Hi everybody! I''m new at ruby on rails, I''m trying to create a view like > this: > > *%= semantic_form_for :routes_status_race, :url => > status_race_admin_routes_path do |f| %>* > *<p>* > *<% contact_array = Contact.all.map {|contact| [contact.name, > contact.id]}%>* > *<% route_importer_array = RouteImporter.all.map {|importer| > [importer.name, importer.id]}%>* > * > * > *<b>Contact: <select > size="contact_array.lenght"><%=options_for_select(contact_array)%></b>* > *<b>Route Importer: <select size> "route_importer_array.lenght"><%=options_for_select(route_importer_array)%></b>* > * > * > *<p>* > *<b>Import(csv): <%= f.file_field :uploaded_data, :size => "20" %></b>* > *<b> **<%= submit_tag(''Import'', { :class => "Button" }) %></b>* > *</p>* > *</p>* > > *<% end %>* > > The problem is that is just showing the first options_for_select, I mean > right now I can see in the browser just Contact, but if I change the > order and write Route Importer before I just can see Route Importer. The > Import(csv) and the button are working right. Any idea that why I just > can see the first select option and not both? Thanks in advance!Check the resulting html code, I think you''re missing </select> in both select -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Hi thanks both! Finally I solved it like this: <%= f.inputs do%> <%= f.input :contact, :as => :select, :collection => Contact.all %> <%= f.input :route_import, :as => :select, :collection => RouteImporter.all %> <%end%> It creates a fieldset with both select options :) On Tuesday, November 6, 2012 10:40:01 AM UTC+1, Anna wrote:> > Hi everybody! I''m new at ruby on rails, I''m trying to create a view like > this: > > *%= semantic_form_for :routes_status_race, :url => > status_race_admin_routes_path do |f| %>* > *<p>* > * <% contact_array = Contact.all.map {|contact| [contact.name, contact.id > ]}%>* > * <% route_importer_array = RouteImporter.all.map {|importer| [ > importer.name, importer.id]}%>* > * > * > * <b>Contact: <select > size="contact_array.lenght"><%=options_for_select(contact_array)%></b>* > * <b>Route Importer: <select size= > "route_importer_array.lenght"><%=options_for_select(route_importer_array)%></b> > * > * > * > * <p>* > * <b>Import(csv): <%= f.file_field :uploaded_data, :size => "20" %></b>* > * <b> **<%= submit_tag(''Import'', { :class => "Button" }) %> </b>* > * </p> * > *</p>* > > *<% end %>* > > The problem is that is just showing the first options_for_select, I mean > right now I can see in the browser just Contact, but if I change the order > and write Route Importer before I just can see Route Importer. The > Import(csv) and the button are working right. Any idea that why I just can > see the first select option and not both? Thanks in advance! >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/mjd88bATreoJ. For more options, visit https://groups.google.com/groups/opt_out.