With ActiveSupport from Rails it's also possible:
@providers = @authentications.map(&:provider)
--
Thanks, Ivan Povalyukhin

On Dec 25, 7:35 am, Michael Pavling <[email protected]> wrote:
> On 25 December 2010 15:23, Erwin <[email protected]> wrote:
>
> > I am always writing it in 2 lines : ( Array init then loading the
> > array )
>
> >   �...@providers = []
> >   �[email protected] {|authentification| @providers <<
> > authentification.provider }
>
> > Is there any Ruby writing for writing just one line ?
>
>   �...@providers = @authentications.map { |authentication|
> authentication.provider }

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to