title: Ruby on rails: Need to pass drop down ID/value back to the controller
body: <p>I'm new to RoR and I'm trying to pass the drop down id selected by the user back to the controller to load a page specific to a business. I have a simple DB listing ten businesses which loads fine but when I select an option I'm getting this error: <strong>No route matches [POST] "/businesses/1/2/3/4/5/6/7/8/9/10"</strong></p>
  
  <p>Can I get the action value to be dynamic for the form? What are some options?</p>
  
  <p>Controller: businesses_controller.rb</p>
  
  <pre><code>  def home
      @business_dd = Business.find(:all)
    end
  
    def update
      @business = Business.find(params[:id])
      redirect_to :action =&gt; "show", :id =&gt; @business
    end
  
    def show
      @business_dd = Business.find(:all)
      @business = Business.find(params[:id])
    end
  </code></pre>
  
  <p>View: _header.html.erb</p>
  
  <pre><code>&lt;%= form_for :business, :url =&gt; business_path(@business_dd) do |f| %&gt;               
          &lt;%= f.select(:id, options_for_select(
          @business_dd.map{ |f| [f.name, f.id]}), 
          :include_blank =&gt; 'Please select') %&gt;
          &lt;%= f.submit "Submit" %&gt;
      &lt;% end %&gt;
  </code></pre>
  
  <p>HTML generated for the drop down:</p>
  
  <pre><code>&lt;form accept-charset="UTF-8" action="/businesses/1/2/3/4/5/6/7/8/9/10" method="post"&gt;&lt;div style="margin:0;padding:0;display:inline"&gt;&lt;input name="utf8" type="hidden" value="&amp;#x2713;" /&gt;&lt;input name="authenticity_token" type="hidden" value="FS7sYiq8NicsKfnUwzTTHpobtA180qOjcAOnuWNONPc=" /&gt;&lt;/div&gt;                
  &lt;select id="business_id" name="business[id]"&gt;&lt;option value=""&gt;Please select&lt;/option&gt;
  &lt;option value="1"&gt;Business1&lt;/option&gt;
  &lt;option value="2"&gt;Business2&lt;/option&gt;
  &lt;option value="3"&gt;Business3&lt;/option&gt;
  &lt;option value="4"&gt;Business4&lt;/option&gt;
  &lt;option value="5"&gt;Business5&lt;/option&gt;
  &lt;option value="6"&gt;Business6&lt;/option&gt;
  &lt;option value="7"&gt;Business7&lt;/option&gt;
  &lt;option value="8"&gt;Business8&lt;/option&gt;
  &lt;option value="9"&gt;Business9&lt;/option&gt;
  &lt;option value="10"&gt;Business10&lt;/option&gt;&lt;/select&gt;
  &lt;input name="commit" type="submit" value="Submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Routes:</p>
  
  <pre><code>      Prefix Verb   URI Pattern                    Controller#Action
    businesses GET    /businesses(.:format)          businesses#index
               POST   /businesses(.:format)          businesses#create
  new_business GET    /businesses/new(.:format)      businesses#new
  edit_business GET    /businesses/:id/edit(.:format) businesses#edit
      business GET    /businesses/:id(.:format)      businesses#show
               PATCH  /businesses/:id(.:format)      businesses#update
               PUT    /businesses/:id(.:format)      businesses#update
               DELETE /businesses/:id(.:format)      businesses#destroy
          root GET    /                              businesses#home
        update GET    /update(.:format)              businesses#update
  </code></pre>