How about:

   [:start, :stop].each { |attr| errors.add(a,"date must be....") }

It seems good enough to me, without the need of new APIs. Wdyt?


On Wed, Jan 30, 2013 at 2:16 PM, angelo capilleri <[email protected]>wrote:

> I want made a PR to get the possibility to add more attribute for
> errors.add method:
>
> Ex.
> Now:
> ...
> validate dates_must_be_coherent
>
> def dates must be coherent
>    if start.present? && stop.present? && start > stop
>         errors.add(:start,"date must be ....")
>         errors.add(:stop,"date must be....")
>      end
> end
>
> with the PR:
>
> def dates must be coherent
>    if start.present? && stop.present? && start > stop
>         errors.add([:start, :stop],"date must be ....")
>      end
> end
>
> Thanks for reviews!!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
At.
Carlos Antonio

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to