class Onoma::Reflection
Attributes
Public Class Methods
Source
# File lib/onoma/reflection.rb, line 8 def initialize(active_record, name, options = {}) @options = options @name = name.to_s @active_record = active_record @class_name = options[:class_name] || name.to_s.classify @foreign_key = (options[:foreign_key] || name).to_s @scope = options[:scope] @nomenclature = class_name.tableize @klass = "Onoma::#{@class_name}".constantize end
name: things class_name
: Thing klass: Onoma::Thing
Public Instance Methods
Source
# File lib/onoma/reflection.rb, line 28 def ==(other_aggregation) other_aggregation.is_a?(self.class) && name == other_aggregation.name && !other_aggregation.options.nil? && active_record == other_aggregation.active_record end
Returns true if self and other_aggregation have the same name attribute, active_record
attribute, and other_aggregation has an options hash assigned to it.
Source
# File lib/onoma/reflection.rb, line 35 def all(*args) @klass ? @klass.all(*args) : [] end