Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是一件相当简单的事情,但是由于 Rails 3.2 批量分配保护默认启用,当您尝试通过批量分配设置受保护的属性时,有没有办法让 rails 在开发或测试中引发异常?
在 development.rb 中,默认注释掉以下内容。取消注释。
config.active_record.mass_assignment_sanitizer = :strict