2008-05-02から1日間の記事一覧

has_manyのメソッドの戻り値

class User < ActiveRecord::Base belongs_to :group end class Group < ActiveRecord::Base has_many :users end っていうモデルを作った場合、 >> g1 = Group.find(:first) => #<Group id: 1, ・・・> >> users = g1.users => [#<User id:1m ・・・>] >> users.class => Arrayって出ます。しかも、 </user></group>…