开发者

Help with rails routes

Im having a little trouble setting up routes.

I have a 'users' controller/model/views set up restfully

so users is set up to be a resource in my routes.

I want to change that to be 'usuarios' instead cause the app will be made for spanish speaking region... the reason the user model is in english is cause I was following the authlogic set up and wasnt sure if naming the model usuario instead would create trouble.. so basically this is what I have in mr routes.rb to get this functionality don开发者_StackOverflow中文版e.

map.resources :usuarios,:controller=>"users", :path_names => {:edit => 'editar' }

the problem is that when I try to register a new user I get this error

 ActionController::MethodNotAllowed

Only get, put, and delete requests are allowed.

this happens after I have filled out my register form and clicked on submit...


Have you tried using the 'as' option to change how the url looks without modifying the routes? This example is from the documentation:

# products_path == '/productos'
  map.resources :products, :as => 'productos' do |product|
    # product_reviews_path(product) == '/productos/1234/comentarios'
    product.resources :product_reviews, :as => 'comentarios'
  end


You can try rake routes | grep usuarios from a terminal window (cd to the project root first) to make sure that the proper named routes are setup properly. You can cross reference that with the form tag you are using to make sure that the action for the form is correct.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜