Topic: Simple 'validates_uniquesness_of' failing - why?

I have a simple model with 2 string attributes. I want both of those attributes to be unique. I thought I specified the correct validation, but one of my unit tests passes and the other does not. I have been screwing around with this for way too long and would appreciate any help I can get. Thanks a lot!

Oh, and one other question: When I use YAML fixtures to populate a table the data remains in the table after the last test has run - which is what I expect. But I have some test programs that do not have a fixtures :my_table method in them; the methods themselves populate the table by creating and saving objects. When the tests are done I expect to see leftover data in the tables, but don't. Anyone know why? Thanks again.

Here is the bare-bones code illustrating my validates_uniqueness_of problem:

The Migration:

class CreateSchools < ActiveRecord::Migration
  def self.up
    create_table :schools do |t|
      t.column :name,    :string
      t.column :display, :string

  def self.down
    drop_table :schools

The Model:
class School < ActiveRecord::Base
  has_many :students

  validates_presence_of   :name, :display
  validates_uniqueness_of :name, :display

(Some of the) Unit Tests:
class SchoolTest < Test::Unit::TestCase

  def setup

  # This test works as expected
  def test_duplicate_name
    school = => "Harvard")

    school = => "Harvard")
    assert !
    assert_equal ActiveRecord::Errors.default_error_messages[:taken], school.errors.on(:name)

  # This test does not work - see comments in method
  def test_duplicate_display
    display = "Ivy League"
    school = => "Harvard", :display => display)

    school = => "Yale", :display => display)
    # It seems like these (commented out) tests should pass, but they don't
    #assert !
    #assert_equal ActiveRecord::Errors.default_error_messages[:taken], school.errors.on(:display)
    # This test passes; seems you should not be allowed to save the duplicate-display record.

Re: Simple 'validates_uniquesness_of' failing - why?

The word "display" is on the list of reserved words. I wonder if that is the problem?

Railscasts - Free Ruby on Rails Screencasts

Re: Simple 'validates_uniquesness_of' failing - why?

AARRGGHH!!! Are you kidding me? That was the problem! Thank you thank you thank you RyanB!
(Oooh man, all those hours I spent on this...)
Thanks again, man.