here come the tags
This commit is contained in:
parent
c8732b6332
commit
29368bfdb9
16 changed files with 155 additions and 2 deletions
|
|
@ -1,5 +1,7 @@
|
|||
class Clip < ApplicationRecord
|
||||
has_one_attached :video
|
||||
belongs_to :category
|
||||
has_many :tag_to_clips
|
||||
has_many :tags, through: :tag_to_clips
|
||||
validates :title, presence: true
|
||||
end
|
||||
|
|
|
|||
4
app/models/tag.rb
Normal file
4
app/models/tag.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
class Tag < ApplicationRecord
|
||||
has_many :tag_to_clips
|
||||
has_many :clips, through: :tag_to_clips
|
||||
end
|
||||
4
app/models/tag_to_clip.rb
Normal file
4
app/models/tag_to_clip.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
class TagToClip < ApplicationRecord
|
||||
belongs_to :clip
|
||||
belongs_to :tag
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue