Quick question about AR arrays.

16 views
Skip to first unread message

Samson Oak

unread,
Jun 30, 2014, 5:14:51 PM6/30/14
to rubyonra...@googlegroups.com
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 }

--
Posted via http://www.ruby-forum.com/.

Samson Oak

unread,
Jun 30, 2014, 5:15:51 PM6/30/14
to rubyonra...@googlegroups.com
Oops, I meant Foo.all.each {|foo| foo.bar } for the second one.

manoj c.

unread,
Jul 2, 2014, 2:03:53 AM7/2/14
to rubyonra...@googlegroups.com
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,
Reply all
Reply to author
Forward
0 new messages