Reputation: 388
I've built an ROR application. Now I need to implement Devise feature. I have existing login with users data so I dont want to use devise Sign_in , sign_up etc views. Any suggestion on how can i achieve this
Upvotes: 1
Views: 723
Reputation: 5116
The easiest way is to generate new views and customize them by adding the styles and markup from your old views.
Or see a sample app and copy the forms needed into you existing views, for example:
For a sign in page (new session) devise generates this code
In app/views/devise/sessions/new.html.erb
<h2>Sign in</h2>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
<% if devise_mapping.rememberable? -%>
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
<% end -%>
<div><%= f.submit "Sign in" %></div>
<% end %>
<%= render "devise/shared/links" %>
So I would say the best option is to generate them, and copy the code in your views to the ones generated by devise or copy the devise generated code into your views (the first option is better because it keeps the default devise routing) and you dont need to map the devise controllers to your custom views.
If you really need to use your old views just add the corresponding form and fields, and have the devise controller map to your corresponding views, it's more complicated this way but it can be done, read: https://github.com/plataformatec/devise#configuring-controllers for further info.
Upvotes: 2