我想重写设计注册控制器,以便用户将能够上传他的头像以及更改其他数据,并在上传后裁剪userpic。设计注册控制器+回形针
我添加了所有necesarry用户回形针属性,创建作物观点,我的注册控制器看起来像这样:
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
,但是当我用图片提交表单,什么也没有发生,除了火狐显示“加载。 ..“永远!在开发日志中绝对没有更新.. :(
任何人都可以告诉我,我该怎么办是做错了
PS用户编辑表格看起来像这样:?
虽然Rails 4应用程序如何完成这项工作? – 2013-08-17 00:15:52