add basic support for labels
This commit is contained in:
@@ -3,6 +3,7 @@ class Forum < ActiveRecord::Base
|
||||
has_many :forumthreads
|
||||
belongs_to :role_read, class_name: "Role", foreign_key: "role_read_id"
|
||||
belongs_to :role_write, class_name: "Role", foreign_key: "role_write_id"
|
||||
has_and_belongs_to_many :labels
|
||||
|
||||
def to_s
|
||||
name
|
||||
|
||||
@@ -6,6 +6,7 @@ class Forumthread < ActiveRecord::Base
|
||||
belongs_to :forum
|
||||
belongs_to :user_author, class_name: "User", foreign_key: "user_author_id"
|
||||
belongs_to :user_editor, class_name: "User", foreign_key: "user_editor_id"
|
||||
belongs_to :label
|
||||
has_many :threadreplies
|
||||
|
||||
validates_presence_of :title, :author, :forum
|
||||
|
||||
11
app/models/label.rb
Normal file
11
app/models/label.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class Label < ActiveRecord::Base
|
||||
validates_presence_of :name
|
||||
belongs_to :role
|
||||
has_and_belongs_to_many :forums
|
||||
has_many :forumthreads
|
||||
|
||||
def to_s
|
||||
name.upcase
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user