gitlab-org--gitlab-foss/app/models/project_snippet.rb

28 lines
646 B
Ruby
Raw Normal View History

# == Schema Information
#
# Table name: snippets
#
2014-10-09 15:22:20 +00:00
# id :integer not null, primary key
2016-05-04 17:42:10 +00:00
# title :string
2014-10-09 15:22:20 +00:00
# content :text
# author_id :integer not null
# project_id :integer
# created_at :datetime
# updated_at :datetime
2016-05-04 17:42:10 +00:00
# file_name :string
# type :string
2014-10-09 15:22:20 +00:00
# visibility_level :integer default(0), not null
2013-06-19 12:40:33 +00:00
#
class ProjectSnippet < Snippet
belongs_to :project
belongs_to :author, class_name: "User"
validates :project, presence: true
# Scopes
scope :fresh, -> { order("created_at DESC") }
participant :author, :notes
end