Quick question about AR arrays

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 }

Oops, I meant Foo.all.each {|foo| foo.bar } for the second one.

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs