简体   繁体   中英

How to have two different signup pages in rails (using devise)

I am using devise and the registration form shows at /signup path but I want another page with same registration form but with different text at the top.

I can see the signup page is in /views/devise/registration/new.html.erb but how to make a copy of it and to show it at /signup_new ?

EDIT - I am using

devise_for :users do
   get 'signup_new', :to => 'devise/registrations#new'
end

and now with above code I have got the signup_new redirecting to the form but I do want some different text to be show at the top of it. How can I do it since right now, both /signup and /signup_new are pointing to same form/page. I tried to copy the new.html.erb and created signup_new.html.erb but this is not working

you can update your routes.rb file as..

 devise_for :users do
   get 'signup_new', :to => 'devise/registrations#new'      
 end

In your Devise view, just display different things based on the request url :

<% if request.fullpath.include?('signup_new') %>
    <%= 'text 1' %>
<% else %>
    <%= 'text 2' %>
<% end %>

Side note: you really should NOT have 2 different urls pointing to the same content, for Google it is called duplicate content.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM