Changeset 8208
- Timestamp:
- 11/25/07 22:34:46 (2 years ago)
- Files:
-
- trunk/activerecord/CHANGELOG (modified) (1 diff)
- trunk/activerecord/lib/active_record/validations.rb (modified) (2 diffs)
- trunk/activerecord/test/validations_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r8199 r8208 1 1 *SVN* 2 3 * Allow validates_acceptance_of to use a real attribute instead of only virtual (so you can record that the acceptance occured) #7457 [ambethia] 2 4 3 5 * DateTimes use Ruby's default calendar reform setting. #10201 [Geoff Buesing] trunk/activerecord/lib/active_record/validations.rb
r8172 r8208 415 415 # end 416 416 # 417 # The terms_of_service attribute is entirely virtual. No database column is needed. This check is performed only if418 # terms_of_service is not nil and by default on save.417 # If the database column does not exist, the terms_of_service attribute is entirely virtual. This check is 418 # performed only if terms_of_service is not nil and by default on save. 419 419 # 420 420 # Configuration options: … … 434 434 configuration.update(attr_names.extract_options!) 435 435 436 attr_accessor *attr_names 436 attr_accessor *attr_names.reject { |name| column_names.include? name.to_s } 437 437 438 438 validates_each(attr_names,configuration) do |record, attr_name, value| trunk/activerecord/test/validations_test.rb
r8172 r8208 24 24 class UniqueReply < Reply 25 25 validates_uniqueness_of :content, :scope => 'parent_id' 26 end 27 28 class PlagiarizedReply < Reply 29 validates_acceptance_of :author_name 26 30 end 27 31 … … 291 295 t.terms_of_service = "I agree." 292 296 assert t.save 297 end 298 299 def test_validates_acceptance_of_as_database_column 300 reply = PlagiarizedReply.create("author_name" => "Dan Brown") 301 assert_equal "Dan Brown", reply["author_name"] 293 302 end 294 303