Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 293
iCyborg Avatar asked Dec 20 '22 06:12

iCyborg


2 Answers

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.

like image 149
Raindal Avatar answered Mar 03 '23 05:03

Raindal


you can update your routes.rb file as..

 devise_for :users do
   get 'signup_new', :to => 'devise/registrations#new'      
 end
like image 40
Ramiz Raja Avatar answered Mar 03 '23 03:03

Ramiz Raja