1

モデルのコードは次のとおりです。

class MyModel < ActiveRecord::Base
  def role
    read_attributes(:role).to_sym
  end

  def role= value
    write_attributes :role, value.to_s
  end
end

しかし、次のエラーが発生しました:

undefined method read_attributes for MyModel:0x00000003014070
4

1 に答える 1

0

read_attributes はメソッドではないためです。ですread_attribute

于 2013-07-16T13:04:29.543 に答える