~michaelforrest/use-case-mapper/trunk

« back to all changes in this revision

Viewing changes to vendor/rails/actionpack/lib/action_controller/assertions/model_assertions.rb

  • Committer: Richard Lee (Canonical)
  • Date: 2010-10-15 15:17:58 UTC
  • mfrom: (190.1.3 use-case-mapper)
  • Revision ID: richard.lee@canonical.com-20101015151758-wcvmfxrexsongf9d
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
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