class ViewModel::DownMigrator
down migrations find a reverse path from the current schema version to the specific version requested by the client.
Private Instance Methods
migrate_viewmodel!(view_name, source_version, view_hash, references)
click to toggle source
# File lib/view_model/migrator.rb, line 105 def migrate_viewmodel!(view_name, source_version, view_hash, references) path = @paths[view_name] return false unless path # In a serialized output, the source version should always be the present # and the current version, unless already modified by a parent migration required_version, current_version = @versions[view_name] return false if source_version == required_version unless source_version == current_version raise ViewModel::Migration::UnspecifiedVersionError.new(view_name, source_version) end path.reverse_each do |migration| migration.down(view_hash, references) end view_hash[ViewModel::VERSION_ATTRIBUTE] = required_version true end