Tuesday, June 14, 2011

[Rails] Routing issue

Hello

I have this in my route.rb

namespace :admin do
resources :accounts do
resources :portals do
post 'create'
post 'edit'
post 'show'
end
end
end

Actually, from the beginning it looked like this:

namespace :admin do
resources :accounts do
resources :portals
end
end

Before, but even now, when I go to
/admin/accounts/1/portals

Then the method named create was executed.
Even when I go to /admin/accounts/1/portals/create
the same method is executed

I need now to execute the method edit

If I try to call it with GET, then it works. So pasting in the
browser
/admin/accounts/1/portals/edit

works.

But the thing is that this should be a POST. So when I try to access
this page, with curl, specifying it is a POST, then I get a

Routing Error

No route matches "/admin/accounts/1/portals/edit"

So it didnt help putting the specific route with post and get into the
admin-portals-resource.

What is wrong? Maybe a simple thing, but Im very unexperienced in ROR.
Thanks.


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate