Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # >> @test = Report.new({"document_id"=>nil, "created_at"=>nil, "updated_at"=>nil, "when"=>nil})
- # => #<Report id: nil, document_id: nil, when: nil, created_at: nil, updated_at: nil>
- # >> @test.reasons << Reason.find_or_create_by_content("pr") # yay, invalid records mass fest, validation will occur on save
- # => [#<Reason id: nil, content: "pr", created_at: nil, updated_at: nil>]
- # >> @test.save
- # => false # all green
- #
- # >> @test = Report.first
- # => #<Report id: 1, document_id: 1, ...
- # >> @test.reasons << Reason.find_or_create_by_content("pr") # ACK
- # ActiveRecord::RecordInvalid: Validation failed: Content is too short (minimum is 3 characters)
Add Comment
Please, Sign In to add comment