There's an echo in my head

日々のメモ。

2012-11-08から1日間の記事一覧

has_one, has_many, belongs_toでconditionsを動的にする

Rails has_many with dynamic conditionsより、ActiveRecord 3.1+ではprocを使う必要があるみたい。3.2.8で確認済み。 class User has_many :pictures has_one :profile_picture, class_name: "Picture", foreign_key: "user_id", conditions: proc { ["id =…

ruby 2.0.0-preview1を入れてみる(失敗中)

ruby-installの一覧を更新したあとで、rbenvで2.0.0を入れたらopensslがrequireできない を見ながらチャレンジ。 $ brew upgrade openssl Error: openssl-1.0.1c already installed $ CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl` rbenv inst…

rbenv install(ruby-build)の一覧の更新

rbenvのプラグインとしてインストールしている場合、 $ cd ~/.rbenv/plugins/ruby-build $ git pull $ rbenv rehash Homebrewで入れている場合、 $ brew upgrade ruby-build ただしこちらは更新が遅いので、横着してHomebrewで入れるよりもrbenvのプラグイン…

このブログに出てくるコードスニペッツは、引用あるいは断りがない限りMITライセンスです。