Module: Ronin::Model::ClassMethods

Defined in:
lib/ronin/model/model.rb

Overview

Class methods that are added when Ronin::Model is included into a class.

Instance Method Summary collapse

Instance Method Details

#load(records, query) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Loads and initialize the resources.


84
85
86
87
88
89
# File 'lib/ronin/model/model.rb', line 84

def load(records,query)
  resources = super(records,query)
  resources.each { |resource| resource.send :initialize }

  return resources
end

#relationship_nameSymbol

The default name to use when defining relationships with the model.

Returns:

  • (Symbol)

    The name to use in relationships.

Since:

  • 1.0.0


73
74
75
76
77
# File 'lib/ronin/model/model.rb', line 73

def relationship_name
  name = Support::Inflector.underscore(self.name.split('::').last)

  return Support::Inflector.pluralize(name).to_sym
end