Model では、attr_accessible と attr_protected というクラスメソッドがあります。
これらについて。
- class User < ActiveRecord::Base
- attr_accessible :name, :email
- attr_protected :id
- end
attr_accessible は、代入を許されている (publicのの様なもの) カラムで、attr_protected は、代入を許さない (newや@params['user']['name'], attribute=.. のようなもの) カラムを指定するもの。
attr_accessible に指定しないものは、 attr_protected になる様です。
ちなみに、メソッドを介してのカラムの値の変更は大丈夫です。