开发商!我无法理解下一个情况
例如我有模型
- class Pg::City < ActiveRecord::Base
- belongs_to :country
- #virtual accessors
- attr_accessor :population
- #attr_accessible :city,:isdisabled,:country_id
- end
我可以使用这样的代码:
- c = Pg::City.new({:population=>1000})
- puts c.population
- 1000
但如果我取消注释上面的attr_accessible代码抛出警告
- WARNING: Can't mass-assign protected attributes: population