0 Replies - 449 Views - Last Post: 12 May 2014 - 02:44 PM Rate Topic: -----

#1 mohamed_sharawy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-May 14

getting error while sign in my ruby on rials application using facebok

Posted 12 May 2014 - 02:44 PM

this is my model

class User < ActiveRecord::Base
def self.from_omniauth(auth)
	auth.to_a.each do |a|
    where(a.slice(:provider, :uid)).first_or_initialize.tap do |user|
     user.provider = auth.provider
      user.uid = auth.uid
      user.name = auth.info.name
      user.oauth_token = auth.credentials.token
      user.oauth_expires_at = Time.at(auth.credentials.expires_at)
      user.save!
    end
end
  end
end



this is my sessions controller
class SessionsController < ApplicationController

def create
    user = User.from_omniauth(env["omniauth.auth"])
    user.each do |u|
    session[:user_id] = u.id
    redirect_to root_url
end
  end

  def destroy
    session[:user_id] = nil
    redirect_to root_url
 end
 end









and i am getting this error when i am trying to make a callback to my application

[error]TypeError in SessionsController#create
no implicit conversion of Symbol into Integer
Extracted source (around line #4):


def self.from_omniauth(auth)
auth.to_a.each do |a|
where(a.slice(:provider, :uid)).first_or_initialize.tap do |user|
user.provider = auth.provider
user.uid = auth.uid
user.name = auth.info.name
[/error]
can anyone help me to know what is that error please??

Is This A Good Question/Topic? 0
  • +

Page 1 of 1