Using custom registrations controller

This commit is contained in:
Raphael 2010-09-15 17:05:21 -07:00
parent e0ffc8bba0
commit 01d26f6d0e
4 changed files with 16 additions and 5 deletions

View file

@ -8,8 +8,21 @@ class RegistrationsController < Devise::RegistrationsController
end
def create
User.instantiate!(params[:user])
redirect_to root_url
begin
user = User.instantiate(params[:user])
rescue MongoMapper::DocumentNotValid => e
user = nil
flash[:error] = e.message
end
puts user
if user
#set_flash_message :notice, :signed_up
flash[:notice] = "You've joined Diaspora!"
#redirect_to root_url
sign_in_and_redirect(:user, user)
else
redirect_to "/get_to_the_choppa"
end
end
def update

View file

@ -289,7 +289,7 @@ class User
def self.instantiate( opts = {} )
opts[:person][:diaspora_handle] = "#{opts[:username]}@#{opts[:url]}"
opts[:person][:serialized_key] = generate_key
User.create(opts)
User.create!(opts)
end
def seed_aspects

View file

@ -2,7 +2,6 @@
= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
= devise_error_messages!
= f.hidden_field :url, :value => request.host
%p
= f.label :username

View file

@ -53,7 +53,6 @@ describe Aspect do
it 'belong to a user' do
@aspect.user.id.should == @user.id
@user.aspects.size.should == 3
@user.aspects.first.id.should == @aspect.id
end
it 'should have people' do