Class: Protobuf::ActiveRecord::Serialization::ClassMethods::CollectionAssociationCaller
- Inherits:
-
Object
- Object
- Protobuf::ActiveRecord::Serialization::ClassMethods::CollectionAssociationCaller
- Defined in:
- lib/protobuf/active_record/serialization.rb
Instance Method Summary collapse
- #call(selph) ⇒ Object
-
#initialize(method_name) ⇒ CollectionAssociationCaller
constructor
A new instance of CollectionAssociationCaller.
Constructor Details
#initialize(method_name) ⇒ CollectionAssociationCaller
Returns a new instance of CollectionAssociationCaller.
143 144 145 |
# File 'lib/protobuf/active_record/serialization.rb', line 143 def initialize(method_name) @method_name = method_name end |
Instance Method Details
#call(selph) ⇒ Object
147 148 149 150 151 |
# File 'lib/protobuf/active_record/serialization.rb', line 147 def call(selph) selph.__send__(@method_name).to_a rescue NameError # Has happened when field is not on model or ignored from db return nil end |