Skip to content

Instantly share code, notes, and snippets.

@mpattee
Created February 12, 2012 18:39
Show Gist options
  • Save mpattee/1810137 to your computer and use it in GitHub Desktop.
Save mpattee/1810137 to your computer and use it in GitHub Desktop.
test validation in console
Loading development environment (Rails 2.3.11)
>> i = Item.find_by_id(50568)
=> #<Item id: 50568, character_id: 20370, created_at: "2012-02-12 18:13:16", updated_at: "2012-02-12 18:13:16", name: "New Item", url: "", quantity: 2, price: "", weight: "", itemDescription: "">
>> i.quantity = nil
=> nil
>> i.save
=> false
>> i.errors
=> #<ActiveRecord::Errors:0x1035eea08 @base=#<Item id: 50568, character_id: 20370, created_at: "2012-02-12 18:13:16", updated_at: "2012-02-12 18:13:16", name: "New Item", url: "", quantity: nil, price: "", weight: "", itemDescription: "">, @errors=#<OrderedHash {"quantity"=>[#<ActiveRecord::Error:0x1035edd38 @type=:blank, @base=#<Item id: 50568, character_id: 20370, created_at: "2012-02-12 18:13:16", updated_at: "2012-02-12 18:13:16", name: "New Item", url: "", quantity: nil, price: "", weight: "", itemDescription: "">, @attribute=:quantity, @options={:default=>nil}, @message=:blank>]}>>
>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment