Guest User

Untitled

a guest
Feb 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. Cassady:~/dev/scratch/plugin-testing yossef$ script/console
  2. Loading development environment (Rails 2.0.2)
  3. />> cat = Category.new
  4. => #<Category id: nil, name: nil>
  5. >> cat.name = 'testing'
  6. => "testing"
  7. >> i = Item.new
  8. => #<Item id: nil, code: nil, category_id: nil>
  9. >> i.code = 'test-1234'
  10. => "test-1234"
  11. >> i.valid?
  12. => false
  13. >> i.errors.full_messages
  14. => ["Category can't be blank"]
  15. >> cat.items << i
  16. => [#<Item id: nil, code: "test-1234", category_id: nil>]
  17. >> i.valid?
  18. => false
  19. >> i.errors.full_messages
  20. => ["Category can't be blank"]
  21. >> cat.save
  22. => false
  23. >> cat.errors
  24. => #<ActiveRecord::Errors:0x23d06c4 @base=#<Category id: nil, name: "testing">, @errors={"items"=>["is invalid"]}>
  25. >> exit
Add Comment
Please, Sign In to add comment