모듈: Mongoid::Attributes::Readonly::ClassMethods
- 다음에 정의됨:
- lib/mongoid/attributes/readonly.rb
인스턴스 메서드 요약 접기
-
#attr_readonly(*names) ⇒ 객체
속성을 읽기 전용으로 정의합니다.
인스턴스 메서드 세부 정보
#attr_readonly(*names) ⇒ 객체
참고:
상위 클래스에 읽기 전용 속성이 포함되어 있고 다음과 같은 경우
속성을 읽기 전용으로 정의합니다. 이렇게 하면 문서가 새 문서이거나 생성 중인 경우에만 속성 값이 설정됩니다. 다른 경우에는 오류가 발생하는 #remove_attribute 및 #update_attribute를 제외하고 필드 쓰기가 무시됩니다.
inherited by a child class, the child class will inherit the parent's readonly attributes at the time of its creation. Updating the parent does not propagate down to child classes after wards.
65 66 67 68 69 70 |
# 파일 'lib/mongoid/attributes/readonly.rb', 줄 65 def attr_readonly(*이름) self.readonly_attributes = readonly_attributes.dup 이름.각 do |이름| readonly_attributes << database_field_name(이름) end end |