おもしろwebサービス開発日記

Ruby や Rails を中心に、web技術について書いています

2009-05-28から1日間の記事一覧

has_manyなモデルのid配列を取得するスマートなやり方

今日たまたまRailsのリファレンスを眺めていて見つけたのですが。下記のようなBlogモデルとEntryモデルがあるとします。 class Blog < ActiveRecord::Base has_many :entries end class Entry < ActiveRecord::Base belongs_to :blog end Blogモデルのインス…