Rails3 Devise custom routing for confirmable module?

Devise is very complex solution so when you want to ovverride some functionality, first you should read source code because when you don't know what some method do you can easily break logic of Devise work. Looking in source code is not so difficult as you can imagine and I think it is best to study of writing good code.

Up vote 1 down vote favorite share g+ share fb share tw.

I am trying to route a user to a custom welcome page after they confirm their account via devise's confirmable. The custom page is located at /districts/setup/, reachable by districts_setup_path. To do this I added the custom route, devise_for :users, :controllers => { :registrations => 'registrations', :confirmations => 'confirmations' } and created my own controller.

Then I had to overload the confirmations_controller. Rb and now have: (app/controllers/confirmations_controller. Rb) class ConfirmationsController | Devise::ConfirmationsController # GET /resource/confirmation?

Confirmation_token=abcdef def show self. Resource = resource_class. Confirm_by_token(params:confirmation_token) if resource.errors.

Empty? Set_flash_message(:notice, :confirmed) if is_navigational_format? Sign_in(resource_name, resource) redirect_to districts_setup_path else render_with_scope :new # not: # respond_with_navigational(resource.

Errors, :status => :unprocessable_entity){ end end end This works well, but I am nervous that I am not doing this in the mostideal and robust way. In particular, I just deleted the respond_with_navigational( ... ) lines which I really don't understand. I am hoping to write this all up in a how-to for the Devise wiki, and am just looking for feedback being fairly new to rails and even newer to Devise/engines/warden.

Ruby-on-rails-3 devise link|improve this question asked Apr 25 '11 at 1:05bonhoffer41139 89% accept rate.

I've been testing this and it seems to work fine. – bonhoffer Apr 27 '11 at 2:59 Shouldn't there be a way to just write a helper method which provides the correct path? I'm trying to figure this also.

– RyanJM Jun 1 '11 at 22:32.

I've obviously been digging in the source code to pull out the method I overloaded. I am asking this question, because I want to make sure I am not breaking the logic in some way I don't understand. – bonhoffer Apr 25 '11 at 18:01 How is this answer helpful?

Read the manual / source is not an acceptable answer on SO. – Doug Feb 20 at 19:32.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions