【发布时间】:2014-01-10 19:39:22
【问题描述】:
我正在学习嵌套资源,并在尝试编辑事件时收到以下错误。事件资源嵌套在用户资源下。有什么建议吗?
ActiveRecord::RecordNotFound:
Couldn't find Event with id=133 [WHERE "user_events"."user_id" = $1]
# ./app/controllers/events_controller.rb:32:in `edit'
# ./spec/features/user_edits_reg_info.rb:69:in `block (2 levels) in <top (required)>'
事件控制器
def edit
@event = current_user.events.find(params[:id])
end
【问题讨论】:
标签: ruby-on-rails database nested rails-activerecord