Class: AmazingActivist::Base

Inherits:
Object
  • Object
show all
Extended by:
Irresistible
Defined in:
lib/amazing_activist/base.rb

Overview

Abstract activity class.

Example

source,ruby

class OnboardActivity < AmazingActivist::Base

prop :params, _Hash(Symbol, _Any?), :**

def call
  user = User.new(params)

  return success(user) if user.save

  failure(:invalid_params, user: user)
end

end

case OnboardActivity.call(email: “[email protected]”) in success: user

Current.user = user
redirect_to dashboard_url

else

render :new, status: :unprocessable_entity

end


Instance Method Summary collapse

Instance Method Details

#callSuccess, Failure

Returns:



39
40
41
# File 'lib/amazing_activist/base.rb', line 39

def call
  failure(:not_implemented)
end