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 rubyonrails-core+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
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
<capilleri@gmail.com>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 rubyonrails-core+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-core@googlegroups.com.
> 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 rubyonrails-core+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Thanks Carlitos, It seems good enough also to me Il giorno mercoledì 30 gennaio 2013 17:26:25 UTC+1, Carlos Antonio da Silva ha scritto:> > 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 <capi...@gmail.com<javascript:> > > 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 rubyonrails-co...@googlegroups.com <javascript:>. >> To post to this group, send email to rubyonra...@googlegroups.com<javascript:> >> . >> 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 rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.