search for: validate_each

Displaying 6 results from an estimated 6 matches for "validate_each".

Did you mean: validates_each
2011 Jan 02
0
"Confirmation" succeeds when the *_confirmation attribute was neglected from the Model.
...validates(:password, :confirmation => true, :presence => true) end activemodel/lib/active_model/validations/confirmation.rb: 3 # == Active Model Confirmation Validator 4 module Validations 5 class ConfirmationValidator < EachValidator 6 def validate_each(record, attribute, value) 7 if (confirmed = record.send("#{attribute}_confirmation")) && (value != confirmed) 8 record.errors.add(attribute, :confirmation, options) 9 end 10 end </pre> At line 7, since the attribute does not exist,...
2011 Jan 06
4
Not able to insert value in rails console
...ion/finder_methods.rb:122:in `first'' from c:/Ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_reco rd/relation/finder_methods.rb:180:in `exists?'' from c:/Ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_reco rd/validations/uniqueness.rb:39:in `validate_each'' from c:/Ruby/lib/ruby/gems/1.9.1/gems/activemodel-3.0.3/lib/active_model /validator.rb:154:in `block in validate'' from c:/Ruby/lib/ruby/gems/1.9.1/gems/activemodel-3.0.3/lib/active_model /validator.rb:151:in `each'' from c:/Ruby/lib/ruby/gems/1.9.1...
2008 Mar 20
4
Blank DateTime versus Nil DateTime
Hi! These days I have been having trouble with a test that tried to test DateTime functionality. I have discovered that a NULL DateTime is auto-type casted to NIL by Rails. My problem here is that I have a field :datetime and I want to allow NULL datetimes but not wrong datetimes. With this validation if deadline is wrong or if is is blank it returns true. How I can accomplish this? protected def
2012 Sep 18
2
undefined method `to_sym' for nil:NilClass
...i all, I am trying to upgrade my rails 2 app to 3 and am getting this error when trying to login: NoMethodError in AuthenticateController#authenticate undefined method `to_sym'' for nil:NilClass The stack trace is: activerecord (3.2.2) lib/active_record/validations/uniqueness.rb:26:in `validate_each'' activemodel (3.2.2) lib/active_model/validator.rb:153:in `validate'' activemodel (3.2.2) lib/active_model/validator.rb:150:in `each'' activemodel (3.2.2) lib/active_model/validator.rb:150:in `validate'' activesupport (3.2.2) lib/active_support/callbacks.rb:310:in `...
2013 Nov 14
6
validates :boolean_field, presence: true misconceptions
Last night a friend of mine started ranting about validates_presence_of :boolean_field returning not valid when the boolean field is false. I checked the rails issues and this seems to be a pretty common concern about the naming of ''presence'' . Instead of changing the behaviour of the presence validator, I was wondering if maybe the answer to avoid such misconceptions could be
2011 Jun 11
15
after initialize blowing up---help
All, Can anyone see what''s happening here? ================== migration ======================= class CreateGreetings < ActiveRecord::Migration def self.up create_table :greetings do |t| t.string :greet t.string :language t.integer :count t.timestamps end end def self.down drop_table :greetings end end ================== greeting.rb