Displaying 4 results from an estimated 4 matches for "validates_size_of".
2010 Feb 10
6
validation problems
Hi, there.
I have two validations in the model:
validates_numericality_of :value, :only_integer=>true,
:allow_blank=>true
validates_size_of :value, :is=>9, :message=>"must be 5-digit number",
:if=>Proc.new{|u| u.value.is_a?(Numeric)}
They work as expected except when the :value is character/string like
"a" "abc", the second validation will also output error message "must be
5-digit number&qu...
2007 Oct 13
4
Chapter 9
...ass Order < ActiveRecord::Base
include ActiveMerchant::Billing
before_validation :set_status
attr_protected :id, :customer_ip, :status, :error_message, :updated_at, :created_at
attr_accessor :card_type, :card_number, :card_expiration_month, :card_expiration_year, :card_verification_value
validates_size_of :order_items, :minimum => 1
validates_length_of :ship_to_first_name, :in => 2..255
validates_length_of :ship_to_last_name, :in => 2..255
validates_length_of :ship_to_address, :in => 2..255
validates_length_of :ship_to_city, :in => 2..255
validates_length_of :ship_to_postal_...
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2005 Dec 21
10
Investigating Unicode. Take 2, with nastities and allegations.
...#39;t help, because Unicode is hard.
You wonder WHY that happens? Well... String#strip is Unicode-unaware.
As are String#empty? and (thusly) String#blank? But don''t reach out
for your fixtures just yet! Because I''m far from finished...
Let''s move on:
class User
validates_size_of :name, :maximum=>5
end
Ok, this is our User. Now let''s see if I can use this application:
my_name = [1070, 1083, 1080, 1082].pack("U*")
in case you wonder - this is my name in Russian, spelled like "Юлик".
The one my mother gave to me.
User.new(:login=>'...