Class: ViewModel::Migration
- Inherits:
-
Object
- Object
- ViewModel::Migration
- Defined in:
- lib/view_model/migration.rb
Defined Under Namespace
Classes: Builder, NoPathError, OneWayError, StrictMigrationError, 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
23 24 25 |
# File 'lib/view_model/migration.rb', line 23 def down(view, _references) raise ViewModel::Migration::OneWayError.new(view[ViewModel::TYPE_ATTRIBUTE], :down) end |
#up(view, _references) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/view_model/migration.rb', line 15 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 |