Module: Either::ActiveModelHelpers

Defined in:
lib/either/active_model_helpers.rb

Instance Method Summary collapse

Instance Method Details

#to_eitherObject



5
6
7
8
9
10
11
# File 'lib/either/active_model_helpers.rb', line 5

def to_either
  if self.errors.present?
    Either::Left.new(self.errors)
  else
    Either::Right.new(self)
  end
end