Skip to content

Instantly share code, notes, and snippets.

@nordringrayhide
Created September 23, 2010 18:15
Show Gist options
  • Save nordringrayhide/594079 to your computer and use it in GitHub Desktop.
Save nordringrayhide/594079 to your computer and use it in GitHub Desktop.
class Signup::CustomersController < ApplicationController
inherit_resources
defaults :resource_class => User, :collection_name => 'users', :instance_name => 'user'
actions :new, :create
def create
create! do |success, failure|
success.html do
resource.roles |= [Role.find_by_name('customer')]
flash[:notice] = "Customer #{resource.name} successfuly registered"
sign_in(resource)
redirect_to root_path
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment