Skip to content

Instantly share code, notes, and snippets.

@brycesenz
Created October 13, 2013 21:50
Show Gist options
  • Save brycesenz/6967780 to your computer and use it in GitHub Desktop.
Save brycesenz/6967780 to your computer and use it in GitHub Desktop.
DCI Controller example with delegators
# GET /user/password/edit?reset_password_token=abcdef
def edit
context = ResettingPassword.new
context.add_subscriber(EditDelegator.new(self))
context.find_for_reset(params[:reset_password_token])
end
class EditDelegator < ApplicationDelegator
def success(user)
render :action => :edit, :locals => { :user => user }
end
def failure(user)
flash[:alert] = view_messenger.message(:edit, :error)
redirect_to new_user_session_path
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment