在我看来,Ruby 代码使我在 heroku 上的 rails 应用程序崩溃。同时它在开发中工作。我正在使用 HAML。
= @sold
- @sold.each do |x|
%p lorem
无论@sold 是否等于 nil 或它是否具有值,它都会在第二行中断。 - @sold.each do |x|
你们有任何线索,为什么?
控制器:
def activity
@user = current_user
@selling = @user.products.where( "quantity != ?", 0 )
@sold = @user.products.where( "quantity == ?", 0 )
end
编辑: Heroku 日志说
"HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
2013-10-21T03:21:40.646768+00:00 app[web.1]: 21: %p one
2013-10-21T03:21:40.646570+00:00 app[web.1]: 20: - @sold.each do |x|
2013-10-21T03:21:40.646570+00:00 app[web.1]: 17: %button Status
2013-10-21T03:21:40.646570+00:00 app[web.1]: 18: %tbody
2013-10-21T03:21:40.646570+00:00 app[web.1]: 19: = @sold
2013-10-21T03:21:40.646768+00:00 app[web.1]: app/views/users/activity.html.haml:20:in `_app_views_users_activity_html_haml___1193554036748909609_69954007105480