module Formalism::ModelForms::Move
Base
form for model moving
Constants
- POSSIBLE_DIRECTIONS
Attributes
direction[R]
Public Class Methods
new(direction, primary_field_value, how_many = 1)
click to toggle source
Calls superclass method
Formalism::ModelForms::Base::new
# File lib/formalism/model_forms/move.rb, line 13 def initialize(direction, primary_field_value, how_many = 1) @direction = direction.to_sym @how_many = how_many.to_i super(primary_field_name => primary_field_value) end
Private Instance Methods
execute()
click to toggle source
Calls superclass method
Formalism::ModelForms::Base#execute
# File lib/formalism/model_forms/move.rb, line 30 def execute instance.public_send(:"move_#{@direction}", @how_many) super end
validate()
click to toggle source
# File lib/formalism/model_forms/move.rb, line 24 def validate return if POSSIBLE_DIRECTIONS.include?(@direction) errors.add :direction, :unknown, args: { direction: @direction } end