Rails-2.3からRackに対応した事と関連が深いと思うのですが、 ruby-openidを使っていると、logger関係のエラーが出るようです。 ruby-openidでは、デフォルトでは以下のように

   1      @@logger = Logger.new(STDERR)

STDERRを使うようになっているのですが、これがRackと相性が悪いようです。 以下のように、config/initializers/*.rbあたりで別途loggerを設定すると良いようです。

   1  OpenID::Util::logger = Logger.new(File.join(Rails.root, %w(log openid.log)))

posted by Png genki on Wed 1 Apr 2009 at 21:18

polymorphic_urlの中身で使われている build_named_route_callのソースを貼付けておきます。

   1        def build_named_route_call(records, namespace, inflection, options = {})
   2          unless records.is_a?(Array)
   3            record = extract_record(records)
   4            route  = ''
   5          else
   6            record = records.pop
   7            route = records.inject("") do |string, parent|
   8              if parent.is_a?(Symbol) || parent.is_a?(String)
   9                string << "#{parent}_"
  10              else
  11                string << "#{RecordIdentifier.__send__("plural_class_name", parent
  12  )}".singularize
  13                string << "_"
  14              end
  15            end
  16          end
  17  
  18          if record.is_a?(Symbol) || record.is_a?(String)
  19            route << "#{record}_"
  20          else
  21            route << "#{RecordIdentifier.__send__("plural_class_name", record)}"
  22            route = route.singularize if inflection == :singular
  23            route << "_"
  24          end
  25  
  26          action_prefix(options) + namespace + route + routing_type(options).to_s
  27        end

posted by Png genki on Wed 1 Apr 2009 at 13:18

Railsでモデルのバージョン管理を行うというと、 acts_as_versionedを使うのが一般的でしたが、 しばらくメンテナンスされていないのと、githubでforkがカオス状態になっていて、公式ドキュメントと実装が一致しなくなっているなど、ちょっと使いにくい状況になっているようなので、それ以外の選択肢を調べてみました。

  • version_fu かなりシンプルな作り。ソースは100行程度。そのぶん、Versionedテーブルの作成などは自動でやってくれない。
  • SimplyVersioned こちらもシンプル路線。Versionedテーブルを使わずに、1つのテーブルでhas_manyアソシエーションを使って管理するタイプ。validates_uniqueness_ofとかを使っていないならこれでも良いかな。
  • acts_as_versioned_association aavでassociationを含むモデルのバージョニングが出来なかった問題を解決したものらしい。
posted by Png genki on Wed 1 Apr 2009 at 11:51
Contents
ruby-openidをRails-2.3.2で使う時の注意点
build_named_route_callに関するメモ
Rails向けモデルのバージョン管理プラグインの紹介
Comments
瀧内元気: MacOS版は以下にあります * [genki/ViMouse](https://githu... '23-1
dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これ... '13-1
瀧内元気: おお、チェックしてみます。thx! '11-12
overisland: Reeder for iPhone もこの UI を実装していますね。 '11-12
瀧内元気: その情報は見たのですが、以下のサイトによると、現在はまた必要になってるっぽいんですよね。 ... '11-12
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ