forgeplus/app/models/project_topic.rb

26 lines
670 B
Ruby

# == Schema Information
#
# Table name: project_topics
#
# id :integer not null, primary key
# user_id :integer
# name :string(255)
# position :integer default("0")
# projects_count :integer default("0")
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_project_topics_on_user_id (user_id)
#
class ProjectTopic < ApplicationRecord
belongs_to :user, optional: true
has_many :project_topic_ralates, dependent: :destroy
has_many :projects, through: :project_topic_ralates
validates :name, uniqueness: { case_sensitive: false }
end