I’m following this: tutorial
user = User.new :name => auth_hash["user_info"]["name"], :email => auth_hash["user_info"]["email"]
user.authorizations.build :provider => auth_hash["provider"], :uid => auth_hash["uid"]
user.save
render :text => "Hi #{user.name}! You've signed up."
I was browsing the DB and inspecting table authorization and fount out the table is empty.
why is that?
EDIT:
I get this error:
Oops, something went wrong: [“Authorizations is invalid”]
this is user.rb:
class User < ActiveRecord::Base
has_many :topics
has_many :authorizations
attr_accessible :email, :name
validates :name, :email, :presence => true
end
this is authorization.rb:
class Authorization < ActiveRecord::Base
belongs_to :user
validates :provider, :uid, :presence => true
attr_accessible :provider, :uid
end
Always check return values: