Module: Abyme::Model

Defined in:
lib/abyme/model.rb

Defined Under Namespace

Modules: ClassMethods Classes: AttributesBuilder

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#allow_destroyObject

Returns the value of attribute allow_destroy.



29
30
31
# File 'lib/abyme/model.rb', line 29

def allow_destroy
  @allow_destroy
end

#permitted_attributesObject (readonly)

Returns the value of attribute permitted_attributes.



30
31
32
# File 'lib/abyme/model.rb', line 30

def permitted_attributes
  @permitted_attributes
end

Class Method Details

.included(klass) ⇒ Object



37
38
39
40
41
# File 'lib/abyme/model.rb', line 37

def self.included(klass)
  @permitted_attributes[klass.name] ||= {}
  @allow_destroy[klass.name] ||= {}
  klass.extend ClassMethods
end

.permit_attributes(class_name, association, attributes, permit, association_class_name = nil) ⇒ Object



32
33
34
35
# File 'lib/abyme/model.rb', line 32

def self.permit_attributes(class_name, association, attributes, permit, association_class_name = nil)
  @permitted_attributes[class_name]["#{association}_attributes".to_sym] = AttributesBuilder.new(class_name, association, attributes, permit, association_class_name)
    .build_attributes
end