在Devise中,Validatable模块包含
validates_uniqueness_of :email, :allow_blank => true, :if => :email_changed?
如何禁用此验证器?
我的Rails应用程序生成错误页面非常缓慢(Rail 3.1/3.2,ruby 1.9.2/1.9.3).例如,我已将my_bad_variable添加到某个.haml模板中
Rendered fees/index.html.haml within layouts/application (97752.1ms)
Completed 500 Internal Server Error in 99579ms
ActionView::Template::Error (undefined local variable or method `my_bad_variable' for #<#:0x00000003bbf0c8>):
Completed 200 OK in 327ms (Views: 274.7ms | ActiveRecord: 9.8ms)
Rendered fees/index.html.haml within layouts/application (97752.1ms)
Completed 500 Internal Server Error in 99579ms
ActionView::Template::Error (undefined local variable or method `my_bad_variable' for #<#:0x00000003bbf0c8>):
删除这个假变量后:
Completed 200 OK in 327ms (Views: 274.7ms | ActiveRecord: 9.8ms)
有什么建议?
如何在ActionMailer中将prawn pdf渲染为附件?我使用delayed_job并且不明白,我怎么能在动作邮件程序中渲染pdf文件(不在控制器中).我应该使用什么格式?
如何使用update_attributes指定validation_context?
我可以使用2个操作(没有update_attributes)来做到这一点:
my_model.attributes = { :name => '123', :description => '345' }
my_model.save(:context => :some_context)
Run Code Online (Sandbox Code Playgroud)