Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Interactions

 Interactions

A lightning talk covering the ActiveInteraction gem.

Video of Presentation @ Big Ruby Conference 2014
https://www.youtube.com/watch?v=Gn75H9D3nOg#t=3m22s.

ActiveInteraction
http://orgsync.github.io/active_interaction/

Aaron Lasseigne

February 21, 2014
Tweet

More Decks by Aaron Lasseigne

Other Decks in Programming

Transcript

  1. def create @user = User.new(params[:user]) ! if @user.save default_group =

    Community .find(current_community_id) .default_group ! @user.groups.create!(group: default_group) ! Notifications.notify_admin(group).deliver ! Notifications.welcome(@user).deliver else render 'new' end end
  2. class SignUpUser < ActiveInteraction::Base string :name, :email, :password date :birthday,

    default: nil model :community ! validates :name, presence: true validates :email, format: /\A.+@.+\.\w+\z/ validates :password, password: true ! def execute user = User.create!(inputs.slice(:name, :email, :birthday)) ! compose(JoinDefaultGroup, user: user, community: community ) ! Notifications.welcome(user).deliver ! user end end
  3. def execute user = User.create!( inputs.slice(:name, :email, :birthday) ) !

    compose(JoinDefaultGroup, user: user, community: community ) ! Notifications.welcome(user).deliver 
 user end
  4. def execute user = User.create!( inputs.slice(:name, :email, :birthday) ) !

    compose(JoinDefaultGroup, user: user, community: community ) ! Notifications.welcome(user).deliver 
 user end