From 00e658b28d35dd82357da987257aea2c2fc3d73f Mon Sep 17 00:00:00 2001 From: Michael Elfassy Date: Wed, 10 Oct 2012 12:03:18 -0400 Subject: [PATCH] fix for bug undefined method 'belongs_to' for Impression:Class --- app/models/impression.rb | 1 - lib/impressionist/models/active_record/impression.rb | 2 ++ lib/impressionist/models/mongo_mapper/impression.rb | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/impression.rb b/app/models/impression.rb index b4d81ec..9cb2d4e 100644 --- a/app/models/impression.rb +++ b/app/models/impression.rb @@ -1,3 +1,2 @@ class Impression - belongs_to :impressionable, :polymorphic=>true end diff --git a/lib/impressionist/models/active_record/impression.rb b/lib/impressionist/models/active_record/impression.rb index 94c2710..710c446 100644 --- a/lib/impressionist/models/active_record/impression.rb +++ b/lib/impressionist/models/active_record/impression.rb @@ -3,6 +3,8 @@ class Impression < ActiveRecord::Base :controller_name, :action_name, :view_name, :request_hash, :ip_address, :session_hash, :message, :referrer + belongs_to :impressionable, :polymorphic=>true + after_save :update_impressions_counter_cache private diff --git a/lib/impressionist/models/mongo_mapper/impression.rb b/lib/impressionist/models/mongo_mapper/impression.rb index a7d5f64..cc3e97f 100644 --- a/lib/impressionist/models/mongo_mapper/impression.rb +++ b/lib/impressionist/models/mongo_mapper/impression.rb @@ -13,4 +13,6 @@ class Impression key :message, String key :referrer, String timestamps! + + belongs_to :impressionable, :polymorphic=>true end