Permalink
Browse files

reverted uniq emails, added postfix for oauth emails

  • Loading branch information...
1 parent 250a27a commit c71592c142a3e1a4e5bcedf2be3ffc55b88b9bfa @Mik-die Mik-die committed Nov 15, 2011
Showing with 23 additions and 7 deletions.
  1. +1 −2 Gemfile
  2. +10 −1 Gemfile.lock
  3. +1 −4 app/models/user.rb
  4. +11 −0 db/migrate/20111115135334_revert_email_index_on_users.rb
View
@@ -22,8 +22,7 @@ group :development, :test do
gem "cucumber-rails"
gem 'webrat'
gem 'capybara', "= 1.0.0.beta1" # remove this line when rails 3.1
- # until bug with :to_ary not fixed:
- gem "rspec-mocks"
+ gem 'ruby-debug'
end
group :test do
View
@@ -48,6 +48,7 @@ GEM
xpath (~> 0.1.4)
childprocess (0.2.2)
ffi (~> 1.0.6)
+ columnize (0.3.4)
cucumber (1.1.1)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
@@ -87,6 +88,8 @@ GEM
thor (~> 0.14)
json (1.6.1)
json_pure (1.6.1)
+ linecache (0.46)
+ rbx-require-relative (> 0.0.4)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
@@ -141,6 +144,7 @@ GEM
rdoc (~> 3.4)
thor (~> 0.14.4)
rake (0.8.7)
+ rbx-require-relative (0.0.5)
rdoc (3.11)
json (~> 1.4)
riddle (1.5.0)
@@ -157,6 +161,11 @@ GEM
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.7.0)
+ ruby-debug (0.10.4)
+ columnize (>= 0.1)
+ ruby-debug-base (~> 0.10.4.0)
+ ruby-debug-base (0.10.4)
+ linecache (>= 0.3)
rubyzip (0.9.4)
sass (3.1.10)
selenium-webdriver (2.10.0)
@@ -203,8 +212,8 @@ DEPENDENCIES
rails (= 3.0.10)
rails_config
rake (= 0.8.7)
- rspec-mocks
rspec-rails
+ ruby-debug
sass
thinking-sphinx
webrat
View
@@ -7,8 +7,6 @@ class User < ActiveRecord::Base
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :name
- validates :email, :uniqueness => {:scope => :oauth}
-
has_many :discussions, :as => :author
has_many :says, :as => :author
@@ -21,10 +19,9 @@ def self.find_or_create_for_github(response)
if user = User.where(:oauth_id => data["id"], :oauth => 'github').first
user
else
- user = User.new(:email => data["email"], :password => Devise.friendly_token[0,20])
+ user = User.new :email => "#{data["email"]}.github", :password => Devise.friendly_token[0,20], :name => data["name"]
user.oauth_id = data["id"]
user.oauth = 'github'
- user.name = data["name"]
user.save
user
end
@@ -0,0 +1,11 @@
+class RevertEmailIndexOnUsers < ActiveRecord::Migration
+ def self.up
+ remove_index :users, :email
+ add_index :users, :email, :unique => true
+ end
+
+ def self.down
+ remove_index :users, :email
+ add_index :users, :email
+ end
+end

0 comments on commit c71592c

Please sign in to comment.