iCyborg
iCyborg

Reputation: 4728

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

Upvotes: 4

Views: 2845

Answers (2)

Raindal
Raindal

Reputation: 3237

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.

Upvotes: 6

Ramiz Raja
Ramiz Raja

Reputation: 6030

you can update your routes.rb file as..

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

Upvotes: 5

Related Questions