I am trying to override the registration registration controller so that the user can upload his avatar along with changing other data and trim the userpic after loading.
I added all the necessary paperclip attributes of the user, created an idea of ββthe lessons, and my registration controller looks like this:
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 the image, nothing happens, except that firefox shows "loading ..." forever! absolutely no updates in the development log ..: (
can someone tell me what i can do wrong?
ps. user editing form is as follows:
<%= 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 %>
Pavel K.
source share