I am using Rails 4, Ruby 2.2, and the latest version of the 'Devise' gem.
So far, I have generated a devise User resource, and created a migration with custom fields (firstName, lastName, etc). This worked fine.
I created a strong parameter on my applications controller, seen here:
before_action :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :password, :email, :firstName, :lastName, :dateofBirth, :address1, :address2, :city, :state, :zip)}
end
I proceeded to create a view for the User resource with the devise command on my terminal. I checked my routes via rake to ensure that I am loading "new.html.erb" file upon the URL "/users/sign_up".
The issue I am having is when I go to update my sign up form on new, it doesn't update! I have changed the code to include other fields, but it still shows the same standard form that comes with devise (email, password, password confirmation), even though in the erb file that is linked through the route i have explicitly added three more fields for username and first name and last name.
I have tried editing the header and even that doesn't update! When I update other view files, they update fine, so it is not an overall view issue.
This is my code for the "new.html.erb":
<h2>Sign up</h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div class="field">
<%= f.label :username %><br />
<%= f.text_field :username, autofocus: true %>
</div>
<div class="field">
<%= f.label :firstName %><br />
<%= f.text_field :firstName %>
</div>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email %>
</div>
<div class="field">
<%= f.label :password %>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em>
<% end %><br />
<%= f.password_field :password, autocomplete: "off" %>
</div>
<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %>
</div>
<div class="actions">
<%= f.submit "Sign up" %>
</div>
<% end %>
<%= render "users/shared/links" %>
I am speculating the devise gem may be overriding the user specific view and sending a default view (which would explain no updating), but am not sure how to solve this issue if this is indeed the issue.
Thanks in advance !
new.html.erbfor update action too? - Pavan