Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:rails/rails
Browse files Browse the repository at this point in the history
  • Loading branch information
dhh committed Jun 1, 2008
2 parents f9db769 + ef21e01 commit cb59c93
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 262 deletions.
69 changes: 0 additions & 69 deletions actionpack/lib/action_view/compiled_templates.rb

This file was deleted.

192 changes: 0 additions & 192 deletions actionpack/test/template/compiled_templates_test.rb

This file was deleted.

2 changes: 1 addition & 1 deletion activerecord/lib/active_record/validations.rb
Expand Up @@ -692,7 +692,7 @@ def validates_format_of(*attr_names)
raise(ArgumentError, "A regular expression must be supplied as the :with option of the configuration hash") unless configuration[:with].is_a?(Regexp)

validates_each(attr_names, configuration) do |record, attr_name, value|
record.errors.add(attr_name, configuration[:message]) unless value.to_s =~ configuration[:with]
record.errors.add(attr_name, configuration[:message] % value) unless value.to_s =~ configuration[:with]
end
end

Expand Down
6 changes: 6 additions & 0 deletions activerecord/test/cases/validations_test.rb
Expand Up @@ -583,6 +583,12 @@ def test_validate_format_numeric
assert_nil t.errors.on(:title)
end

def test_validate_format_with_formatted_message
Topic.validates_format_of(:title, :with => /^Valid Title$/, :message => "can't be %s")
t = Topic.create(:title => 'Invalid title')
assert_equal "can't be Invalid title", t.errors.on(:title)
end

def test_validates_inclusion_of
Topic.validates_inclusion_of( :title, :in => %w( a b c d e f g ) )

Expand Down

0 comments on commit cb59c93

Please sign in to comment.