Forum: Ruby on Rails Quick question about AR arrays.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E67a06cac83a4800368d373c6d704fe9?d=identicon&s=25 Samson Oak (1800dataplz)
on 2014-06-30 23:13
If I have a method "bar" on a model "Foo", this should not work right?

Foo.all.bar

Should be this?

Foo.all.each {|foo| Foo.bar }
E67a06cac83a4800368d373c6d704fe9?d=identicon&s=25 Samson Oak (1800dataplz)
on 2014-06-30 23:14
Oops, I meant Foo.all.each {|foo| foo.bar } for the second one.
A6c7cfa37248fca2135254bc5e776843?d=identicon&s=25 manoj c. (manoj_c)
on 2014-07-02 08:02
Samson Oak wrote in post #1151218:
> Oops, I meant Foo.all.each {|foo| foo.bar } for the second one.

Yes, second one should work as your method is a instance method
Thanks.
Manoj Menon,
This topic is locked and can not be replied to.