I'm Getting an Error: I'm developing a web with Facebook Integration.. I'm new in ruby on rails. can you help with my problem.
ActiveModel::MassAssignmentSecurity::Error in SessionsController#create
Can't mass-assign protected attributes: name
This is my controller:
class SessionsController < ApplicationController
  def create
    #render :json => request.env['omniauth.auth'].to_yaml
   auth = request.env['omniauth.auth']
    unless @auth = Authorization.find_from_hash(auth)
      @auth = Authorization.create_from_hash(auth, current_user)
    end
    self.current_user = @auth.user  
    render :text => "Welcome, #{current_user.name}."
   end
end
This is my user model:
class User < ActiveRecord::Base
  has_many :authorizations
  attr_accessor :name, :uid, :provider
  def self.create_from_hash!(hash)
    #create(:name => hash['user_info']['name'])
   create(:name => hash.info.name)
  end
end
This is my authorization model:
class Authorization < ActiveRecord::Base
  belongs_to :user
  validates_presence_of :user_id, :uid, :provider
  validates_uniqueness_of :uid, :scope => :provider
  def self.find_from_hash(hash)
    find_by_provider_and_uid(hash['provider'], hash['uid'])
  end
  def self.create_from_hash(hash, user = nil)
    user ||= User.create_from_hash!(hash)
    Authorization.create(:user => user, :uid => hash['uid'], :provider => hash['provider'])
  end
end
how can I fix this .. Thanks in advance :)
 
     
    