Created
March 16, 2015 19:02
-
-
Save zmackie/cabd176036ba4989d395 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class QueueItem < ActiveRecord::Base | |
belongs_to :video | |
belongs_to :user | |
validates_uniqueness_of :video_id, scope: :user_id | |
validates_numericality_of :position, { only_integer: true } | |
delegate :title, to: :video, prefix: true | |
delegate :category, to: :video | |
def category_name | |
category.name if category | |
end | |
def rating | |
binding.pry | |
review = Review.where(user_id: user.id) | |
end | |
private | |
def self.queue_position | |
QueueItem.all.count + 1 | |
end | |
def review | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment