Colin:

Below are the relevant code.  Thanks for your help.

class CreateStats < ActiveRecord::Migration

  def self.up
    create_table  :stats do |t|

      t.integer   :user_id,     :null => false
      t.string    :aspect,      :null => false, :default => "default 
aspect"

      t.timestamps
    end
  end

  def self.down
    drop_table :stats
  end
end


class Stat < ActiveRecord::Base

  belongs_to :user
  validates_presence_of   :user_id
  validates_associated    :user

  validates_uniqueness_of :aspect, :scope => :user_id

  attr_readonly :user_id, :aspect

end

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to