小编max*_*axs的帖子

在Devise中跳过电子邮件验证

在Devise中,Validatable模块包含 validates_uniqueness_of :email, :allow_blank => true, :if => :email_changed? 如何禁用此验证器?

ruby-on-rails devise

10
推荐指数
2
解决办法
6174
查看次数

Rails应用程序需要很长时间才能生成错误页面

我的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)

有什么建议?

performance ruby-on-rails

7
推荐指数
1
解决办法
381
查看次数

在ActionMailer中使用Rails 3 Render Prawn pdf

如何在ActionMailer中将prawn pdf渲染为附件?我使用delayed_job并且不明白,我怎么能在动作邮件程序中渲染pdf文件(不在控制器中).我应该使用什么格式?

ruby-on-rails actionmailer prawn

7
推荐指数
1
解决办法
2781
查看次数

validation_context和update_attributes

如何使用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)

ruby-on-rails update-attributes

4
推荐指数
1
解决办法
2425
查看次数