【发布时间】:2012-09-30 21:20:28
【问题描述】:
例如,有一个Question 模型has_many :answers
我想在questions#show 上显示新答案的表单(就像 stackoverflow 一样)
路线类似于:
resources :questions do
resources :answers
end
在这些情况下,显示无效记录错误的最佳方式是什么?
问题是我不能在AnswersController 中render 执行我需要的操作(因为它将是questions#show),唯一的方法似乎是redirect_to 并将错误存储在flash 哈希中.
这看起来很常见,我相信应该有更好的方法
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-3 grails-controller respond-with