Class: ViewModel::Migration
- Inherits:
-
Object
- Object
- ViewModel::Migration
- Defined in:
- lib/view_model/migration.rb
Defined Under Namespace
Classes: Builder, NoPathError, OneWayError, UnspecifiedVersionError
Constant Summary collapse
- REFERENCE_ONLY_KEYS =
[ ViewModel::TYPE_ATTRIBUTE, ViewModel::ID_ATTRIBUTE, ViewModel::VERSION_ATTRIBUTE, ].freeze
Instance Method Summary collapse
Instance Method Details
#down(view, _references) ⇒ Object
22 23 24 |
# File 'lib/view_model/migration.rb', line 22 def down(view, _references) raise ViewModel::Migration::OneWayError.new(view[ViewModel::TYPE_ATTRIBUTE], :down) end |
#up(view, _references) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/view_model/migration.rb', line 14 def up(view, _references) # Only a reference-only view may be (trivially) migrated up without an # explicit migration. if (view.keys - REFERENCE_ONLY_KEYS).present? raise ViewModel::Migration::OneWayError.new(view[ViewModel::TYPE_ATTRIBUTE], :up) end end |