Skip to content

Instantly share code, notes, and snippets.

@zmackie
Created March 16, 2015 19:02
Show Gist options
  • Save zmackie/cabd176036ba4989d395 to your computer and use it in GitHub Desktop.
Save zmackie/cabd176036ba4989d395 to your computer and use it in GitHub Desktop.
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