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)
# include attr_accessible base on
# rails version
@klass = base
should_include?
base.
belongs_to(:impressionable,:polymorphic => true)
base.belongs_to(:impressionable,:polymorphic => true)
end
private
attr_reader :klass
def self.should_include?
toggle = Impressionist::RailsToggle.new(Rails::VERSION::MAJOR)
self.include_attr_accessible unless toggle.valid?
end
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,
:ip_address,:session_hash,:message,:referrer)