Module: Citier4::InstanceMethods

Included in:
ChildInstanceMethods, RootInstanceMethods
Defined in:
lib/citier4/instance_methods.rb

Defined Under Namespace

Modules: ForcedWriters Classes: CitierUniquenessValidator

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



25
26
27
# File 'lib/citier4/instance_methods.rb', line 25

def self.included(base)
  base.send :include, ForcedWriters
end

Instance Method Details

#attributes_for_currentObject



16
17
18
# File 'lib/citier4/instance_methods.rb', line 16

def attributes_for_current
   attributes.select { |key,value| self.class::Writeable.column_names.include?(key) }
end

#attributes_for_parentObject

get the attributes of the class which are inherited from it’s parent.



6
7
8
# File 'lib/citier4/instance_methods.rb', line 6

def  attributes_for_parent
  attributes.select { |key,value| self.class.superclass.column_names.include?(key) }
end

#changed_attributes_for_currentObject



20
21
22
23
# File 'lib/citier4/instance_methods.rb', line 20

def changed_attributes_for_current
  key_changed = changed.select{ |key| self.class::Writeable.column_names.include?(key) }
  attributes.select { |key,vlaue| key_changed.include?(key) } 
end

#changed_attributes_for_parentObject

get the changes attributes of the class which are inherited from it’s parent.



11
12
13
14
# File 'lib/citier4/instance_methods.rb', line 11

def  changed_attributes_for_parent
  key_changed = changed.select{ |key| self.class.superclass.column_names.include?(key) }
  attributes.select { |key,vlaue| key_changed.include?(key) }     
end