Skip to content

Instantly share code, notes, and snippets.

@diegorv
Created March 5, 2009 19:43
Show Gist options
  • Save diegorv/74514 to your computer and use it in GitHub Desktop.
Save diegorv/74514 to your computer and use it in GitHub Desktop.
class Forum < ActiveRecord::Base
attr_accessible :name, :description
has_many :topics, :order => "created_at DESC", :dependent => :destroy
has_many :posts, :through => :topics
validates_length_of :name, :maximum => 255, :allow_nil => true
validates_length_of :description, :maximum => 1000, :allow_nil => true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment