Views

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| %>

  • <% contact_array = Contact.all.map {|contact| [contact.name,
    contact.id]}%>*
  • <% route_importer_array = RouteImporter.all.map {|importer|
    [importer.name, importer.id]}%>*
  • Contact: <%=options_for_select(contact_array)%>*
  • Route Importer: <%=options_for_select(route_importer_array)%>
  • *

  • Import(csv): <%= f.file_field :uploaded_data, :size => “20” %>*
  •    <b> **<%= submit_tag('Import', { :class => "Button" }) %> </b>*
    
  • *

<% 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!

Anna ha scritto:


<% 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 in both
select

On 6 November 2012 09:40, Anna [email protected] wrote:

Contact: <select
<% 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

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 :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs