Class: ViewModel::ActiveRecord::Controller::ViewmodelIdSerializer
- Inherits:
-
IknowParams::Serializer
- Object
- IknowParams::Serializer
- ViewModel::ActiveRecord::Controller::ViewmodelIdSerializer
- Defined in:
- lib/view_model/active_record/controller.rb
Overview
Viewmodel ids are permitted to be either integers or strings
Instance Method Summary collapse
-
#initialize ⇒ ViewmodelIdSerializer
constructor
A new instance of ViewmodelIdSerializer.
- #load(val) ⇒ Object
Constructor Details
#initialize ⇒ ViewmodelIdSerializer
Returns a new instance of ViewmodelIdSerializer.
101 102 103 |
# File 'lib/view_model/active_record/controller.rb', line 101 def initialize super(::Object) end |
Instance Method Details
#load(val) ⇒ Object
105 106 107 108 109 110 111 112 113 |
# File 'lib/view_model/active_record/controller.rb', line 105 def load(val) case val when ::Integer, ::String val else raise IknowParams::Serializer::LoadError.new( "Incorrect type for #{self.class.name}: #{val.inspect}:#{val.class.name}") end end |