From 1234abb2667ea0a67aca8ef26f63f2d7c1f79d8b Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Mon, 13 May 2013 12:32:41 +0200 Subject: [PATCH] taggable_type should be accessible for test --- app/models/tagging.rb | 2 +- test/models/tagging_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/tagging.rb b/app/models/tagging.rb index c067b31e..528856b2 100644 --- a/app/models/tagging.rb +++ b/app/models/tagging.rb @@ -3,7 +3,7 @@ class Tagging < ActiveRecord::Base - attr_accessible :taggable_id, :tag + attr_accessible :taggable_id, :tag, :taggable_type belongs_to :tag belongs_to :taggable, :polymorphic => true, :touch => true diff --git a/test/models/tagging_test.rb b/test/models/tagging_test.rb index a7d33d7b..9bcf942a 100644 --- a/test/models/tagging_test.rb +++ b/test/models/tagging_test.rb @@ -5,9 +5,9 @@ class TaggingTest < ActiveSupport::TestCase def test_removes_unused_tags tag = Tag.create!(:name => "hello") - tagging = Tagging.create!(:tag => tag, :taggable_id => 1) + tagging = Tagging.create!(:tag => tag, :taggable_id => 1, :taggable_type => "Todo") - assert_equal 1, Tagging.find(:all, :conditions => ["tag_id = ?", tag.id]).count + assert_equal 1, Tagging.where("tag_id = ?", tag.id).count tagging.destroy