This commit is contained in:
Toks
2014-02-28 19:02:30 -05:00
parent fee7228aaf
commit 5d5caf5eea
4 changed files with 5 additions and 5 deletions

View File

@@ -25,7 +25,7 @@ module PostSets
end
def posts
favorites.includes(:post).map(&:post)
favorites.includes(:post).map(&:post).compact
end
def presenter

View File

@@ -2,7 +2,7 @@ class ArtistCommentary < ActiveRecord::Base
attr_accessible :post_id, :original_description, :original_title, :translated_description, :translated_title
validates_uniqueness_of :post_id
belongs_to :post
has_many :versions, :class_name => "ArtistCommentaryVersion", :foreign_key => :post_id, :primary_key => :post_id, :order => "artist_commentary_versions.id ASC"
has_many :versions, :class_name => "ArtistCommentaryVersion", :dependent => :destroy, :foreign_key => :post_id, :primary_key => :post_id, :order => "artist_commentary_versions.id ASC"
after_save :create_version
def original_present?

View File

@@ -9,7 +9,7 @@ class Note < ActiveRecord::Base
validates_presence_of :post_id, :creator_id, :updater_id, :x, :y, :width, :height
validate :post_must_exist
validate :note_within_image, :message => "must be inside the image"
has_many :versions, :class_name => "NoteVersion", :order => "note_versions.id ASC"
has_many :versions, :class_name => "NoteVersion", :dependent => :destroy, :order => "note_versions.id ASC"
after_save :update_post
after_save :create_version
validate :post_must_not_be_note_locked

View File

@@ -23,7 +23,7 @@ class Post < ActiveRecord::Base
belongs_to :uploader, :class_name => "User"
belongs_to :parent, :class_name => "Post"
has_one :upload, :dependent => :destroy
has_one :artist_commentary
has_one :artist_commentary, :dependent => :destroy
has_many :flags, :class_name => "PostFlag", :dependent => :destroy
has_many :appeals, :class_name => "PostAppeal", :dependent => :destroy
has_many :versions, :class_name => "PostVersion", :dependent => :destroy, :order => "post_versions.updated_at ASC, post_versions.id ASC"
@@ -32,7 +32,7 @@ class Post < ActiveRecord::Base
has_many :comments, :order => "comments.id", :dependent => :destroy
has_many :children, :class_name => "Post", :foreign_key => "parent_id", :order => "posts.id"
has_many :disapprovals, :class_name => "PostDisapproval", :dependent => :destroy
has_many :favorites
has_many :favorites, :dependent => :destroy
validates_uniqueness_of :md5
validate :post_is_not_its_own_parent
attr_accessible :source, :rating, :tag_string, :old_tag_string, :old_parent_id, :old_source, :old_rating, :last_noted_at, :parent_id, :as => [:member, :builder, :gold, :platinum, :contributor, :janitor, :moderator, :admin, :default]