module DuckRecord::Core::ClassMethods

Public Instance Methods

allocate() click to toggle source
Calls superclass method
# File lib/duck_record/core.rb, line 20
def allocate
  define_attribute_methods
  super
end
generated_association_methods() click to toggle source
# File lib/duck_record/core.rb, line 33
def generated_association_methods
  @generated_association_methods ||= begin
    mod = const_set(:GeneratedAssociationMethods, Module.new)
    private_constant :GeneratedAssociationMethods
    include mod

    mod
  end
end
inspect() click to toggle source

Returns a string like 'Post(id:integer, title:string, body:text)'

# File lib/duck_record/core.rb, line 44
def inspect
  if abstract_class?
    "#{super}(abstract)"
  else
    attr_list = attribute_types.map { |name, type| "#{name}: #{type.type}" } * ", "
    "#{super}(#{attr_list})"
  end
end