Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Serial < ActiveRecord::Base
- has_attached_file :cover
- has_many :serial_seasons, :dependent => :delete_all
- has_many :episodes, :through => :serial_seasons, :dependent => :delete_all
- validates :title, :uniqueness => true, :presence => true
- validates :description, :uniqueness => true, :presence => true
- validates :cover_file_name, :presence => true
- validates :started_at, :presence => true
- def to_label
- "#{title}"
- end
- end
- class SerialSeason < ActiveRecord::Base
- belongs_to :serial
- has_many :episodes, :dependent => :delete_all
- validates :title, :presence => true
- validates :serial_id, :presence => true
- def to_label
- "#{title}"
- end
- end
- class Episode < ActiveRecord::Base
- belongs_to :serial_season
- belongs_to :serial
- validates :title, :presence => true
- validates :serial_id, :presence => true
- validates :serial_season_id, :presence => true
- validates :vk_frame, :uniqueness => true, :presence => true
- def to_label
- "#{title}"
- end
- end
Add Comment
Please, Sign In to add comment