1

I am following http://railscasts.com/episodes/52-update-through-checkboxes. There a form can be written like this: <% form_tag update_multiple_products_path, :method => :put do %>. This does not generate the right action (action="/products") so i have to manually setup the action url.

Is there a away to write form_for without :url parameter?

My setup:

# index.html.erb
<%= form_for update_multiple_products_path, :url => {:action => 'update_multiple'}, :method => :put do %>

# routes.rb
resources :products do
    collection do
      put :update_multiple
    end
  end

# productscontroller
class ProductsController < ApplicationController
  ...
  def update_multiple
4

0 回答 0