Hi every one.. if iam using mongoid(mongo database for creating user) with out having devise gem on it.. how can i find current user.
rails g model user provider uid name oauth_token oauth_expires_at:datetime
invoke mongoid
create app/models/user.rb
invoke test_unit
create test/unit/user_test.rb
create test/fixtures/users.yml
this is way i created user model, in model, i change the code like...
in application.html.erb file how i need to get current user.. here we are using current_user right but if iam raise that, iam getting nill is current user.
Hi every one.. if iam using mongoid(mongo database for creating user) with out having devise gem on it.. how can i find current user.
rails g model user provider uid name oauth_token oauth_expires_at:datetime
invoke mongoid
create app/models/user.rb
invoke test_unit
create test/unit/user_test.rb
create test/fixtures/users.yml
this is way i created user model, in model, i change the code like...
class User
include Mongoid::Document
def self.from_omniauth(auth)
auth.slice(:provider, :uid) do |user|
user.provider = auth.provider
user.uid = auth.uid
user.name = auth.info.name
end
end
end
in application.html.erb file how i need to get current user.. here we are using current_user right but if iam raise that, iam getting nill is current user.