diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index c75ff09a1209653a0ce4580897226f2e942fabd3..96dc54bc9fe7f23609fcf2b246a7c9a3610b6c5e 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -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 diff --git a/app/models/user.rb b/app/models/user.rb index ec313fe8b9264bbc3d3bd5f5fe7de59e8e893a60..625b548758d54f454fdd809232783ab3ee1c618b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/app/views/registrations/new.html.haml b/app/views/registrations/new.html.haml index 212818f41f44fbaea06746b0d9f634f67d933ca2..eefa9451961e0cfea547c37e906587671b8d6677 100644 --- a/app/views/registrations/new.html.haml +++ b/app/views/registrations/new.html.haml @@ -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 diff --git a/spec/models/aspect_spec.rb b/spec/models/aspect_spec.rb index 6bdbf8c1c1e81c5e916dce3695279b0c332a7387..d07d917f57f2ae4f67e4e54bfb781742a2856468 100644 --- a/spec/models/aspect_spec.rb +++ b/spec/models/aspect_spec.rb @@ -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