Using Select Helper

I am having trouble getting the form select helper to use non-numeric
values.

The form is pasted below… I want the f.select to have values
“home”, “category”, etc, not numeric values like shown. However, it
does not seem to work to use [“Home Page”, ‘home’].

From what I can find in the guides, all the examples use numeric
values.

Any ideas?

Thanks,

Andrew P.


<% form_for(@product) do |f| %>
<%= f.error_messages %>

<%= f.label :name %>
<%= f.text_field :name %>

<%= f.label :description %>
<%= f.text_area :description %>

<%= f.label :specs %>
<%= f.text_area :specs %>

<%= f.label :price %>
<%= f.text_field :price %>

<%= f.label :location %>
<%= f.select(:location, options_for_select([['-Select-', ''], ['Home Page', 1], ['Manufacturer Page', 2], ['Category Page', 3], ['Product Page Only', 4]], @product.location)) %>

<%= f.label :tag_id %> <%= f.collection_select :tag_ids, Tag.find(:all, :order => 'name'), :id, :name, {}, :multiple => true %>

<%= f.submit button_label %>

<% end %>

Please ignore. It was a problem with my migration file.

Thanks

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