Rails 4 Tip

RAILS_ROOTRails.root 替换

ActiveRecord 的 White list attributes 被 Strong Parameters Gem 替换

如果使用了 accepts_nested_attributes_for 应当如下使用 `Strong Parameters`

Class User
  accepts_nested_attributes_for :profile
end

# strong parameters
params.require(:user).permit(:name, profile_attributes: [:xxx, :x xx])
This entry was posted in ruby on rails. Bookmark the permalink.

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>