updated readme
This commit is contained in:
19
app/models/forum.rb
Normal file
19
app/models/forum.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class Forum < ActiveRecord::Base
|
||||
|
||||
# Associations
|
||||
has_many :topics, :dependent => :destroy
|
||||
has_many :posts, :through => :topics
|
||||
|
||||
belongs_to :category
|
||||
|
||||
# Accessors
|
||||
attr_accessible :title, :description, :state, :position, :category_id
|
||||
|
||||
# Scopes
|
||||
default_scope :order => 'position ASC'
|
||||
|
||||
# Validations
|
||||
validates :title, :presence => true
|
||||
validates :description, :presence => true
|
||||
validates :category_id, :presence => true
|
||||
end
|
||||
Reference in New Issue
Block a user