ActiveModel::ForbiddenAttributes 错误
来源:互联网 发布:电商美工月度自我评价 编辑:程序博客网 时间:2024/06/05 04:33
很显然,你看的是rails 3的教程,而你的系统是rails 4的。
rails 3 的里面这么写
def create@event = Event.new(params[:event])@event.save;redirect_to :action => :indexend
而 rails 4 中要求这样
def create@event = Event.new(event_params)@event.save;redirect_to :action => :indexenddef show@event = Event.find(params[:id])endprivatedef event_paramsparams.require(:event).permit(:name,:description)end
大概意思就是增加了一层过滤。
官方文档:
http://guides.rubyonrails.org/action_controller_overview.html#strong-parameters
0 0
- ActiveModel::ForbiddenAttributes 错误
- ActiveModel
- rails 4.0 中出现 ActiveModel::ForbiddenAttributesError: ActiveModel::ForbiddenAttributesError 错误
- Rails4版本的ActiveModel::ForbiddenAttributesError错误
- ActiveModel::ForbiddenAttributesError
- 在rails 4.0 中 使用strong_parameters 来避免 ActiveModel::ForbiddenAttributesError 错误
- 在rails 4.0 中 使用strong_parameters 来避免 ActiveModel::ForbiddenAttributesError 错误
- rails中ActiveModel::ForbiddenAttributesError的解决方案
- rails中ActiveModel::ForbiddenAttributesError的解决方案(新)
- rails中ActiveModel::ForbiddenAttributesError的解决方案(新)
- ruby on rails出现的问题ActiveModel::ForbiddenAttributesError
- 错误?
- 错误
- 错误
- 错误
- 错误
- 错误:
- 错误
- LightOJ 1038 Race to 1 Again 期望 记忆化dp
- C++ Primer 第十五章 面向对象编程
- mac os x 触摸板点击无效
- Leetcode【25】:Remove Duplicates from Sorted Array
- java总结(内部类)
- ActiveModel::ForbiddenAttributes 错误
- Leetcode【26】:Remove Element
- 用idea编写appium用例
- WAP、触屏版网站及APP的区别
- CAD 设置原点 UCS M
- vc6静态库的生成和调用
- 【java基础】break continue return
- android开发中资源文件和资源ID是如何映射的
- 创业杂记——重视自己【序】