3a7b39b1067be7843c092388530b0938a920f4c6
[feedcatcher.git] / vendor / rails / actionpack / lib / action_controller / assertions / model_assertions.rb
1 module ActionController
2 module Assertions
3 module ModelAssertions
4 # Ensures that the passed record is valid by Active Record standards and
5 # returns any error messages if it is not.
6 #
7 # ==== Examples
8 #
9 # # assert that a newly created record is valid
10 # model = Model.new
11 # assert_valid(model)
12 #
13 def assert_valid(record)
14 ::ActiveSupport::Deprecation.warn("assert_valid is deprecated. Use assert record.valid? instead", caller)
15 clean_backtrace do
16 assert record.valid?, record.errors.full_messages.join("\n")
17 end
18 end
19 end
20 end
21 end