Override controller actions and routes #61

Closed
TatianaTyu opened this Issue Mar 21, 2011 · 2 comments

Comments

Projects
None yet
2 participants
@TatianaTyu

Hi Sergio,

I've overriden InvitationsController:

class InvitationsController < Devise::InvitationsController

override new and create

end

"new" action works fine, but I cannot access "create" action because of routing.

--- --- My routes: --- ---

as :user do

match "users/invitation/new" => "invitations#new", :via => :get

match "users/invitation" => "invitations#create", :via => :post

end

devise_for :users

--- --- $rake routes shows: --- ---

users_invitation
POST
/users/invitation(.:format)
{:controller=>"invitations", :action=>"create"}


However POST "/users/invitation" still redirects me to Devise::InvitationsController#update .

How to correctly override this route to my Create action?

Kind regards,
Kira

@scambra

This comment has been minimized.

Show comment Hide comment
@scambra

scambra Mar 21, 2011

Owner

Do routes as explained in devise readme, in configuring controllers section:
devise_for :users, :controllers => { :invitations => "invitations" }

Owner

scambra commented Mar 21, 2011

Do routes as explained in devise readme, in configuring controllers section:
devise_for :users, :controllers => { :invitations => "invitations" }

@scambra scambra closed this Mar 21, 2011

@TatianaTyu

This comment has been minimized.

Show comment Hide comment
@TatianaTyu

TatianaTyu Mar 21, 2011

Works perfect! Thank you!

Works perfect! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment