Module: AgentNames
- Included in:
- NameCorporateEntity, NameFamily, NamePerson, NameSoftware
- Defined in:
- backend/app/model/mixins/agent_names.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Object) before_validation
-
- (Object) update_from_json(json, opts = {}, apply_nested_records = true)
Class Method Details
+ (Object) included(base)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'backend/app/model/mixins/agent_names.rb', line 3 def self.included(base) base.set_model_scope :global base.one_to_many :date, :class => "ASDate" base.def_nested_record(:the_property => :use_dates, :contains_records_of_type => :date, :corresponding_to_association => :date) base.one_to_one :name_authority_id base.extend(ClassMethods) end |
Instance Method Details
- (Object) before_validation
19 20 21 22 23 24 25 26 |
# File 'backend/app/model/mixins/agent_names.rb', line 19 def before_validation super # force to NULL (not 0) to make sure uniqueness constraints work as # desired. self. = nil if self. != 1 self.is_display_name = nil if self.is_display_name != 1 end |
- (Object) update_from_json(json, opts = {}, apply_nested_records = true)
29 30 31 32 |
# File 'backend/app/model/mixins/agent_names.rb', line 29 def update_from_json(json, opts = {}, apply_nested_records = true) obj = super self.class.(obj, json) end |