fix undefined local variable

This commit is contained in:
Antonio C Nalesso Moreira 2013-07-11 05:47:51 +01:00
parent 50cebdcb23
commit cf57348c45
1 changed files with 5 additions and 3 deletions

View File

@ -4,20 +4,22 @@ module Impressionist
def self.included(base) def self.included(base)
# include attr_accessible base on # include attr_accessible base on
# rails version # rails version
@klass = base
should_include? should_include?
base. base.belongs_to(:impressionable,:polymorphic => true)
belongs_to(:impressionable,:polymorphic => true)
end end
private private
attr_reader :klass
def self.should_include? def self.should_include?
toggle = Impressionist::RailsToggle.new(Rails::VERSION::MAJOR) toggle = Impressionist::RailsToggle.new(Rails::VERSION::MAJOR)
self.include_attr_accessible unless toggle.valid? self.include_attr_accessible unless toggle.valid?
end end
def self.include_attr_accessible def self.include_attr_accessible
base.attr_accessible(:impressionable_type,:impressionable_id, klass.attr_accessible(:impressionable_type,:impressionable_id,
:user_id,:controller_name,:action_name,:view_name,:request_hash, :user_id,:controller_name,:action_name,:view_name,:request_hash,
:ip_address,:session_hash,:message,:referrer) :ip_address,:session_hash,:message,:referrer)