class Dinamo::Model
Public Class Methods
default_casters(&block)
click to toggle source
# File lib/dinamo/model.rb, line 22 def default_casters(&block) @default_casters ||= block end
inherited(klass)
click to toggle source
# File lib/dinamo/model.rb, line 26 def inherited(klass) klass.callbacks.merge!(callbacks) klass.class_eval &default_casters end
new(**attributes, &block)
click to toggle source
# File lib/dinamo/model.rb, line 59 def initialize(**attributes, &block) with_callback :initialize, **attributes do block.call(self) if block_given? end end
strict(bool)
click to toggle source
# File lib/dinamo/model.rb, line 39 def strict(bool) @strict = bool end
strict?()
click to toggle source
# File lib/dinamo/model.rb, line 43 def strict? @strict.nil? ? true : @strict end
table_name()
click to toggle source
# File lib/dinamo/model.rb, line 31 def table_name @table_name ||= self.name.split(/::/).last.underscore.pluralize end
table_name=(name)
click to toggle source
# File lib/dinamo/model.rb, line 35 def table_name=(name) @table_name = name end