Module ActionController::Assertions::ModelAssertions
In: vendor/rails/actionpack/lib/action_controller/assertions/model_assertions.rb

Methods

Public Instance methods

Ensures that the passed record is valid by Active Record standards and returns any error messages if it is not.

Examples

  # assert that a newly created record is valid
  model = Model.new
  assert_valid(model)

[Source]

    # File vendor/rails/actionpack/lib/action_controller/assertions/model_assertions.rb, line 13
13:       def assert_valid(record)
14:         clean_backtrace do
15:           assert record.valid?, record.errors.full_messages.join("\n")
16:         end
17:       end

[Validate]