i am trying to override devise registrations controller so that user would be able to upload his avatar along with changing other data, and crop the userpic after upload.
i added all necesarry user paperclip attributes, created crop view, and my registrations controller looks like that:
class RegistrationsController < Devise::RegistrationsController
def update
if params[resource_name][:avatar].blank?
super
else
@user=resource
respond_to do |format|
if resource.update_attributes(params[resource_name])
flash[:notice]='Avatar successfully uploaded.'
format.html {
render :action => 'crop'
}
format.xml { head :ok }
else
format.html { render :action => "editpicture" }
format.xml { render :xml => @demotivator.errors, :status => :unprocessable_entity }
end
end
end
end
end
but when i submit the form with picture, nothing happens, except that firefox shows "loading..." forever! absolutely no updates in development log.. :(
could anyone tell me what could i be doing wrong?
ps. user edit form looks like that:
<%= form_for(@user, :url => registration_path(@user), :html => {:id => "userpic_form", :method => :put, :multipart => true}) do |f| %>
<p class="box1_po">Current password: <%= f.password_field :current_password %></p>
<p class="box1_po">Please select your user picture:
<%= f.file_field :avatar %>
</p>
<input type="submit" class="usubmit"><%= link_to "UPLOAD", "#", :onclick => "$('#userpic_form').submit();"%>
<% end %>