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.
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 |