map is defined in the Enumerable module. A has_many association will
return a HasManyAssociation proxy which is a subclass of
AssociationCollection. It is possible that AssociationCollection mixes
in Enumerable, but I can't find it right now.
However, it looks like you are calling map on a User model. Does your
code look like this?
class Group < AR::Base
has_many :users
end
Regards,
kamal
On Jan 14, 2008, at 9:13 PM, Booking Heaven wrote:
> Yes Sir, You're Right, I did set it to has_many before i posted the
> first message. It said : NoMethodError: undefined method 'map' for
> #<User:0x47d4d18>
>
> Even when I try to another way using belongs_to not from your script
> but the same outline with your mind and says error like the first.
>
> What is "map" must be implemented to has_many? I think it works in
> any Relational Object or Table. I dont know how your script is
> working well in your Notebook.
>
>
>
> Rie! <[EMAIL PROTECTED]>
> wrote: On 14/01/2008, Booking Heaven <[EMAIL
> PROTECTED]
> > wrote:
>
>> NOT work at me, i did same things like you. And at
>> Group.find(:all).map { |g| g.users.map(&:email) }
>> it says :
>> NoMethodError: undefined method 'map' for #<User:0x47d4d18>
>>
>> I am using Rails 1.2.3 & Ruby 1.8.5 & OS XP.
>
> make sure you've got the same AR structures (has_many :through or you
> can play it with has_many, too) as mine.
>
> --
> r9 = { name: Rie!, ym: riyari3, skype: rubyninja,
> li: http://linkedin.com/in/ariekeren,
> fb: http://profile.to/ariekeren,
> blog: http://tinyurl.com/2bjgvn }
>
>
>
>
>
> ---------------------------------
> Looking for last minute shopping deals? Find them fast with Yahoo!
> Search.
>
> [Non-text portions of this message have been removed]
>
>
>
> ID-Ruby
> Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk
> segala varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program
> yang dibuat dengan Ruby (Ruby on Rails, JRuby on Rails)
>
> http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
>
>
> Yahoo! Groups Links
>
>
>
Regards,
Kamal