Re: is this syntax correct ? nested form validation

Ryan Bigg
Wed, 21 Jul 2010 08:04:59 -0000

It should be:

 if [@user, @profile].all?(&:valid?)

Get rid of the semi-colon between & and :.

Additionally, please ask questions like these on the rubyonrails-talk
mailing list. This mailing list is reserved for discussion pertaining to the
core of Ruby on Rails.

On 21 July 2010 16:51, kadoudal <kadoudal@gmail.com> wrote:

>   I am trying to replicate a piece of code used to perform a nested
> form validation
>
> it''s written that :
>
>    if [@user, @profile].all?(&;:valid?)
>
> is equivalent to :
>
>   if @user.valid? & @profile.valid?
>
> but the former line fails :   syntax error, unexpected
'';''
>
> what could be the correct syntax ?
>
> thanks fyh
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To post to this group, send email to rubyonrails-core@googlegroups.com.
> To unsubscribe from this group, send email to
>
rubyonrails-core+unsubscribe@googlegroups.com<rubyonrails-core%2Bunsubscribe@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-core?hl=en.
>
>


--
Ryan Bigg / Radar

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at