Rails 2.0 RC1を使うようになったせいかどうかはわからないのですが、何故か僕の環境では acts_as_taggable_on_steroids のplugin testでFailureが一つ出るようになっていたので、修正してみました。

こんなエラーが出る

  1) Failure:
test_tag_destroyed_when_unused(ActsAsTaggableOnSteroidsTest)
    [./test/abstract_unit.rb:81:in \`assert_difference'
     /home/takiuchi/blog/vendor/rails/activerecord/lib/active_record/\
callbacks.rb:309:in \`each_with_index'
     ./test/abstract_unit.rb:80:in \`each'
     ./test/abstract_unit.rb:80:in \`each_with_index'
     ./test/abstract_unit.rb:80:in \`assert_difference'
     ./test/acts_as_taggable_test.rb:328:in \`test_tag_destroyed_when_unused']:
<5> expected but was
<6>.

修正箇所は以下のとおり。

vendor/plugins/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb (L167-184)

ruby>>
def save_tags
return unless @tag_list

  new_tag_names = @tag_list - tags.map(&:name)
  old_tags = tags.reject { |tag| @tag_list.include?(tag.name) }

  self.class.transaction do
    tags.delete(*old_tags) if old_tags.any?
    # added by takiuchi to make all tests green.
    old_tags.each{|tag| tag.destroy} if Tag.destroy_unused
      new_tag_names.each do |new_tag_name|
      tags << Tag.find_or_create_with_like_by_name(new_tag_name)
    end
  end

  true
end

<<--

Tag.destroy_unused が指定されている場合、old_tagsdestroy
するようにしました。これで上記の Failure は出なくなりました。

posted by genki genki on Thu 15 Nov 2007 at 01:47 with 0 comments
Contents rssrss
光ファイバーを二次元振動させて走査するAR用ディスプレイ
因果の取り違え
Swift2's defer for CoffeeScript
mongodb-3.0からcreateIndexのdropDupsが無くなったらしい
mongodb-3.0以降のWiredTigerの設定を動的に変更する方法
一般楕円の高速生成アルゴリズムへの道標
farro mantecatoのレシピ
Droonga関連の記事のまとめ
RuntimeErrorの特定のメッセージに限定してrescueする方法
jQueryでscriptタグを実行せずにappendする
Tags
coffeescriptdefergroongajsmemonodenodejs
Comments rssrss
瀧内元気 瀧内元気: MacOS版は以下にあります genki/ViMouse 01/16 05:40
dsjf dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これでも出... 01/08 23:23
瀧内元気 瀧内元気: おお、チェックしてみます。thx! 12/24 05:23
overisland overisland: Reeder for iPhone もこの UI を実装していますね。 12/24 05:13
瀧内元気 瀧内元気: その情報は見たのですが、以下のサイトによると、現在はまた必要になってるっぽいんですよね。 http:... 12/01 12:20
tkawa tkawa: http://devcenter.heroku.com/articles/rails31_herok... 12/01 10:47
瀧内元気 瀧内元気: どもー。いまはgithubに置いてあります https://github.com/genki/irb... 07/10 08:31
ともち ともち: こんにちは! すばらしいプログラムをありがとうございます。しかし、merbiのドメイン、切れているみ... 07/10 02:30
Services from s21g
YOMU Web小説リーダー
小説投稿サイトの公式ページを開き、WebView表示と読み上げ向け表示を切り替えて、移動中や作業中にもWeb小説の続きを聴きやすくするiPhoneアプリです。
補助探
公開されている補助金・助成金情報を集約し、条件に合う制度を探しやすくするサービスです。
jotter.me
個人開発者のためのホスティング一体型ノートサービス
ハンドミラー
iPhone向けの手鏡アプリ
ツイプロ(twpro)
Twitterプロフィールの高速検索エンジン