Friday, 15 May 2015

ruby on rails - Redirect after devise sign up -



ruby on rails - Redirect after devise sign up -

in sign form have virtual bool parameter :register_as_company (checkbox).

i want users checked box redirected 'companies/new' , else index.

this page has solution https://github.com/plataformatec/devise/wiki/how-to:-redirect-to-a-specific-page-on-successful-sign-up-(registration) don't know how pass parameter method can check if user checked box or not.

is there way this? should start?

in registrationscontroller

def after_sign_in_path_for(resource) if params[:user][:register_as_company] new_company_path else stored_location_for(resource) || root_path end end

ruby-on-rails devise

No comments:

Post a Comment