| Module | ActionController::Assertions::ModelAssertions |
| In: |
vendor/rails/actionpack/lib/action_controller/assertions/model_assertions.rb
|
Ensures that the passed record is valid by ActiveRecord standards and returns any error messages if it is not.
# assert that a newly created record is valid model = Model.new assert_valid(model)
# File vendor/rails/actionpack/lib/action_controller/assertions/model_assertions.rb, line 12
12: def assert_valid(record)
13: clean_backtrace do
14: assert record.valid?, record.errors.full_messages.join("\n")
15: end
16: end