I'm getting the following error when I call an Update method.
ActionController::UnknownFormat (ActionController::UnknownFormat):
app/controllers/devise/custom/registrations_controller.rb:21:in `update_avatar'
Here's the offending controller:
class Devise::Custom::RegistrationsController < Devise::RegistrationsController
respond_to :html, :js
def update_avatar
@user = current_user
if @user.update(user_params)
respond_to do |format|
format.js { render 'update_avatar'}
flash[:notice] = "Updated user"
end
else
render 'edit'
end
end
protected
def user_params
params.require(:user).permit(:avatar)
end
end
What's odd is I use this approach on other controllers without a hitch and yet here it falls over on the respond_to line.
Can anyone shed any light? Thanks!
Log
Processing by Devise::Custom::RegistrationsController#update_avatar as Parameters: {"utf8"=>"✓", "remotipart_submitted"=>"true", "authenticity_token"=>"reTaOwTtvbI+IPYq1nvLWl0blVOmaSu/o5VpfGziguo=", "X-Requested-With"=>"IFrame", "X-Http-Accept"=>"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, /; q=0.01", "user"=>{"avatar"=>#, @original_filename="translate.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"user[avatar]\"; filename=\"translate.jpg\"\r\nContent-Type: image/jpeg\r\n">}}
Processing LessonsController#online_xml [GET]\n Parameters: {"id"=>"57978"}
– Max Williamsformat.html { raise 'We got an HTML request'}
– Max Williams