Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Cassady:~/dev/scratch/plugin-testing yossef$ script/console
- Loading development environment (Rails 2.0.2)
- />> cat = Category.new
- => #<Category id: nil, name: nil>
- >> cat.name = 'testing'
- => "testing"
- >> i = Item.new
- => #<Item id: nil, code: nil, category_id: nil>
- >> i.code = 'test-1234'
- => "test-1234"
- >> i.valid?
- => false
- >> i.errors.full_messages
- => ["Category can't be blank"]
- >> cat.items << i
- => [#<Item id: nil, code: "test-1234", category_id: nil>]
- >> i.valid?
- => false
- >> i.errors.full_messages
- => ["Category can't be blank"]
- >> cat.save
- => false
- >> cat.errors
- => #<ActiveRecord::Errors:0x23d06c4 @base=#<Category id: nil, name: "testing">, @errors={"items"=>["is invalid"]}>
- >> exit
Add Comment
Please, Sign In to add comment