Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
removing conditional and working with provided callbacks
class UserController < ApplicationController
def create
@user_creation =
@user_creation.on_success { redirect_to users_path }
@user_creation.on_failure { render :new }
# This could be provided through a block, adding a bit of syntactic sugar:
@user_creation = do
on_success { redirect_to users_path }
on_failure { render :new }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment