[ select_tag and options_for_select ] posting problem

Hello community!

Here is the problem:

I’m using select_tag and options_for_select for the 50 U.S States to be
sent to the database table called “properties”. But upon a new posting
or editing a posting, it does not post to the database.

<% form_tag :propertiy, :url => properties_url, :html => {:method =>
:put }%>

State: <%= select_tag ("state[]" , options_for_select(['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY'])) %>

Can someone please help?

Here is the whole “new.rhtml” so far:

Create New Property

<%= error_messages_for :property %>

<% form_for :property, :url => property_url(@property), :html => {
:method => :put } do |f| -%>

MLS Number: <%= f.text_field :mls_number, :size => 5 %>

House Number: <%= f.text_field :house_number, :size => 5 %>

Street Name: <%= f.text_field :street_name, :size => 20 %>

City: <%= f.text_field :city, :size => 20 %>

<% form_tag :property, :url => properties_url, :html => {:method => :put } %>

State: <%= select_tag ("state[]" , options_for_select(['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY'])) %>

Listing Agent Information

First <%= f.text_field :list_agent_first_name, :size => 15 %>

Last <%= f.text_field :list_agent_last_name, :size => 15 %>

Listing Company: <%= f.text_field :list_office_name, :size => 15 %>

Bedrooms: <%= f.text_field :bedrooms, :size => 2 %>

<%= submit_tag 'Save' %> or <%= link_to 'cancel', properties_url %> <% end -%>

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