Using Rails 3.2, Devise 3.5.1, SimpleForm
I'm using a custom update method in Devise:
def update
resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
resource_updated = update_resource(resource, account_update_params)
if resource_updated
sign_in resource_name, resource, :bypass => true
redirect_to edit_member_registration_path, notice: "Updated successfully"
else
clean_up_passwords(resource)
redirect_to edit_member_registration_path, alert: resource.errors.full_messages
end
end
This is my form code:
<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= f.error_notification %>
<%= f.input :first_name %>
<%= f.input :last_name %>
<% end %>
Everything works fine, but when there are validation errors, I can't figure out why they are only showing up in the Flash message and not inline.
When I removed the custom update function, I get this behavior, which is exactly what I want:
Is there something wrong with my update function?
Aucun commentaire:
Enregistrer un commentaire