On Tue, Dec 13, 2011 at 8:16 PM, Jim Ruther Nill wrote:
>
> while this may work in your case, you should remember the following (a
> shameless copy
> and paste from the api)
>
> Finally, the options :if, :unless, :on, :allow_blank and :allow_nil can
> be given to one specific validator, as a has
On Wed, Dec 14, 2011 at 12:41 AM, JavierQQ wrote:
>
> Well I found the code here:
>
>
> http://stackoverflow.com/questions/1673812/rails-validation-for-users-email-only-want-it-to-validate-when-a-user-signs-up
>
> validates :score, :presence => true, :if => Proc.new{ (some code
> here) }
>
>
wh
Well I found the code here:
http://stackoverflow.com/questions/1673812/rails-validation-for-users-email-only-want-it-to-validate-when-a-user-signs-up
validates :score, :presence => true, :if => Proc.new{ (some code
here) }
--
You received this message because you are subscribed to the Google
Here is the finished validation, corrected:
def self.validates_is_exact(*attr_names)
options = attr_names.extract_options!
validates_each(*(attr_names << options)) do |record, attr_name, value|
if record.send( options[:compare_field] ) != value
record.errors.add(attr_name, options[:m
I was reading the errors wrong. It's working properly.
Thanks Fred for the advice.
--
Posted via http://www.ruby-forum.com/.
--
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 rubyonrails-t...@googlegro
Thanks for the explanation Fred.
I tried doing this but it's not working properly:
def self.validates_is_exact(*attr_names)
options = attr_names.extract_options!
validates_each(*(attr_names << options)) do |record, attr_name, value|
if record.send( options[:compare_field] ) == value
On Jan 8, 2:59 pm, Alpha Blue wrote:
> What I want to do is ensure that if the redirect box is checked for
> true, that the name field matches the controller_name field precisely.
>
> I'm not sure if validates_presence_of will do it. I may have to create
> a custom validation but am unsure how t
7 matches
Mail list logo