That's weird Riand, g.users should return Enumerable
instead of User object.

First thing come in mind, Rie, is 
Group.find(:all).map(&:users).map(&:email)
Am I wrong ?

--- 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.
> 
> Disconnect
> Riand[FX]
> 
> Rie! <[EMAIL PROTECTED]> wrote:           
>                    ;)) Look at the last line, that's
> the solution
>  
>  $ script/console
>  Loading development environment (Rails 2.0.2)
>  >> Group.count
>  => 1
>  >> User.count
>  => 2
>  >> Group.find(:all).map(&:users.map(&:email))
>  NoMethodError: undefined method `map' for
> :users:Symbol
>   from (irb):3
>  >> Group.find(:all).map(&:(users.map(&:email)))
>  SyntaxError: compile error
>  (irb):4: syntax error, unexpected '(', expecting
> tSTRING_CONTENT or
>  tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
>  Group.find(:all).map(&:(users.map(&:email)))
>                          ^
>  (irb):4: syntax error, unexpected ')', expecting
> $end
>  Group.find(:all).map(&:(users.map(&:email)))
>                                             ^
>   from (irb):4
>  >> Group.find(:all).map(&:{users.map(&:email)})
>  SyntaxError: compile error
>  (irb):5: syntax error, unexpected tLBRACE,
> expecting tSTRING_CONTENT
>  or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
>  Group.find(:all).map(&:{users.map(&:email)})
>                          ^
>  (irb):5: odd number list for Hash
>  Group.find(:all).map(&:{users.map(&:email)})
>                                             ^
>  (irb):5: syntax error, unexpected ')', expecting
> $end
>   from (irb):5
>  >> Group.find(:all).map(&:"users.map(&:email)")
>  NoMethodError: undefined method
> `users.map(&:email)' for #<Group:0x1f57a84>
>   from
>
/Users/arie/RealProjects/xxx.com/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:206:in
>  `method_missing'
>   from
>
/Users/arie/RealProjects/xxx.com/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/symbol.rb:11:in
>  `__send__'
>   from
>
/Users/arie/RealProjects/xxx.com/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/symbol.rb:11:in
>  `to_proc'
>   from (irb):6:in `map'
>   from (irb):6
>  >> Group.find(:all).map { |g| g.users.map(&:email)
> }
>  => [["[EMAIL PROTECTED]"]]
>  >>
>  
>  also be careful of def object end duck typing,
> remember to put it
>  inside parentheses, ex. (def object end).method
>  
>  -- 
>  r9 = { name: Rie!, ym: riyari3, skype: rubyninja,
>  li: http://linkedin.com/in/ariekeren,
>  fb: http://profile.to/ariekeren,
>  blog: http://tinyurl.com/2bjgvn }
>  
>      
>                                
> 
>        
> ---------------------------------
> Never miss a thing.   Make Yahoo your homepage.
> 
> [Non-text portions of this message have been
> removed]
> 
> 



      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

Kirim email ke