autogenerate paths in rails 3?

From the looks of some railscasts (this one in particular), it seems like there is some autogeneration of "*_path" variables that not happening for me. in this rails cast, the edit_mutliple_products_path seems to be generated automagically (i don't normally like using that word). When I follow through the same steps and try to access a similar path, i get this:

undefined local variable or method `edit_multiple_distributions_workflows_path' for #<#<Class:0x132b18a68>:0x132af3290>

Answers


This is rails 2.X. Rails routes changed in Rails 3. in order to get this route add below to routes.rb:

resources :products do
  collection do
    post 'edit_multiple'
    put  'update_multiple'
  end
end

You will be able to access this paths with

edit_multiple_products_url
edit_multiple_products_path
update_multiple_products_url
update_multiple_products_path

instead of edit_multiple_distributions_workflow_path. Btw where did you get this path from? I did not see it in the railscast.


In the given tutorial, which looks like it's from an older Rails, this is the line which would generate the path methods:

map.resources :products, :collection => { :edit_multiple => :post, :update_multiple => :put }

In rails 3, you can see its usage in the docs here: http://guides.rubyonrails.org/routing.html#resource-routing-the-rails-default


Need Your Help

php 3 array loop to send single email from first array

php arrays email loops

I have three arrays. They are all index based arrays [0], [1]... They are:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.