ActiveRecord::ReadonlyAttributes::ClassMethods

module ActiveRecord::ReadonlyAttributes::ClassMethods

Public Instance Methods

attr_readonly(*attributes) Show source

Attributes listed as readonly will be used to create a new record but update operations will ignore these fields.

# File activerecord/lib/active_record/readonly_attributes.rb, line 13
def attr_readonly(*attributes)
  self._attr_readonly = Set.new(attributes.map { |a| a.to_s }) + (self._attr_readonly || [])
end
readonly_attributes() Show source

Returns an array of all the attributes that have been specified as readonly.

# File activerecord/lib/active_record/readonly_attributes.rb, line 18
def readonly_attributes
  self._attr_readonly
end

© 2004–2017 David Heinemeier Hansson
Licensed under the MIT License.

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部