Class: Protobuf::ActiveRecord::Serialization::ClassMethods::CollectionAssociationCaller

Inherits:
Object
  • Object
show all
Defined in:
lib/protobuf/active_record/serialization.rb

Instance Method Summary collapse

Constructor Details

#initialize(method_name) ⇒ CollectionAssociationCaller

Returns a new instance of CollectionAssociationCaller.



138
139
140
# File 'lib/protobuf/active_record/serialization.rb', line 138

def initialize(method_name)
  @method_name = method_name
end

Instance Method Details

#call(selph) ⇒ Object



142
143
144
145
146
# File 'lib/protobuf/active_record/serialization.rb', line 142

def call(selph)
  selph.__send__(@method_name).to_a
rescue NameError # Has happened when field is not on model or ignored from db
  nil
end