Displaying 2 results from an estimated 2 matches for "validati".
Did you mean:
validate
2009 Jun 17
2
validates_uniqueness_of fails on STI in Rails 2.3.2
...ke this:
class Position < ActiveRecord::Base
end
class CartItem < Position
validates_uniqueness_of :product_id
end
When I try to save CartItem I get this error:
ArgumentError: wrong number of arguments (1 for 2)
from
/home/joaz/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:758:in
`exists?''
from
/home/joaz/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:758:in
`validates_uniqueness_of''
from
/home/joaz/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:2148:in
`with_scope''
from
/home/joaz/.gem/r...
2010 Oct 03
7
Rails 3, Validates, Custom Message
In Rails < 3, I could have a validation on model such as:
validates_presence_of :name, :message => "some custom message here"
If I try something similar in Rails 3:
validates :name, :presence => true , :message => "some other custom
message"
obviously, it throws an exception. So the question is, in Rai...