2009/6/26 Frederick Cheung :
>
>
> On Jun 26, 9:10 pm, Philip Hallstrom wrote:
>>
>> Not quite... it looks like an array, but it's not. Otherwise you
>> wouldn't be able to say "p.comments.create()" or
>> "p.comments.find(:conditions => )" but you can.
>>
>> The code above works because
On Jun 26, 9:10 pm, Philip Hallstrom wrote:
>
> Not quite... it looks like an array, but it's not. Otherwise you
> wouldn't be able to say "p.comments.create()" or
> "p.comments.find(:conditions => )" but you can.
>
> The code above works because foobar is defined as class method, n
>>
>> In the code below, p.comments.foobar calls #foobar on every comment.
>> Is there a way to call #foobar only on the comments that belong to
>> post "p"?
>>
>>
>> class Comment < ActiveRecord::Base
>> belongs_to :post
>>
>> def self.foobar; end
>> end
>>
>> class Post <
On Jun 26, 3:51 pm, Colin Law wrote:
> 2009/6/26 Nick Hoffman :
> > In the code below, p.comments.foobar calls #foobar on every comment.
> > Is there a way to call #foobar only on the comments that belong to
> > post "p"?
>
> >
> > class Comment < ActiveRecord::Base
> > belo
2009/6/26 Nick Hoffman :
>
> In the code below, p.comments.foobar calls #foobar on every comment.
> Is there a way to call #foobar only on the comments that belong to
> post "p"?
>
>
> class Comment < ActiveRecord::Base
> belongs_to :post
>
> def self.foobar; end
> end
>
> c
5 matches
Mail list logo