Skip to content

Instantly share code, notes, and snippets.

@jorendorff
Forked from sam452/post.rb
Created December 19, 2012 00:58
Show Gist options
  • Save jorendorff/4333506 to your computer and use it in GitHub Desktop.
Save jorendorff/4333506 to your computer and use it in GitHub Desktop.
require 'video_title_validator'
class Post < ActiveRecord::Base
attr_accessible :body, :title, :image, :video_title, :video_url
validates :video_url, :presence => true, :if => :video_title_present?
def video_title_present?
puts "YES IT IS BEING CALLED, FINALLY"
!self.video_title.blank?
end
belongs_to :author, class_name: "User"
has_many :comments
has_many :parent_comments, class_name: "Comment", conditions: { parent_comment_id: nil }
has_many :images
mount_uploader :image, ImageUploader
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment