fixes #2102
This commit is contained in:
@@ -25,7 +25,7 @@ module PostSets
|
|||||||
end
|
end
|
||||||
|
|
||||||
def posts
|
def posts
|
||||||
favorites.includes(:post).map(&:post)
|
favorites.includes(:post).map(&:post).compact
|
||||||
end
|
end
|
||||||
|
|
||||||
def presenter
|
def presenter
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class ArtistCommentary < ActiveRecord::Base
|
|||||||
attr_accessible :post_id, :original_description, :original_title, :translated_description, :translated_title
|
attr_accessible :post_id, :original_description, :original_title, :translated_description, :translated_title
|
||||||
validates_uniqueness_of :post_id
|
validates_uniqueness_of :post_id
|
||||||
belongs_to :post
|
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
|
after_save :create_version
|
||||||
|
|
||||||
def original_present?
|
def original_present?
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Note < ActiveRecord::Base
|
|||||||
validates_presence_of :post_id, :creator_id, :updater_id, :x, :y, :width, :height
|
validates_presence_of :post_id, :creator_id, :updater_id, :x, :y, :width, :height
|
||||||
validate :post_must_exist
|
validate :post_must_exist
|
||||||
validate :note_within_image, :message => "must be inside the image"
|
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 :update_post
|
||||||
after_save :create_version
|
after_save :create_version
|
||||||
validate :post_must_not_be_note_locked
|
validate :post_must_not_be_note_locked
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class Post < ActiveRecord::Base
|
|||||||
belongs_to :uploader, :class_name => "User"
|
belongs_to :uploader, :class_name => "User"
|
||||||
belongs_to :parent, :class_name => "Post"
|
belongs_to :parent, :class_name => "Post"
|
||||||
has_one :upload, :dependent => :destroy
|
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 :flags, :class_name => "PostFlag", :dependent => :destroy
|
||||||
has_many :appeals, :class_name => "PostAppeal", :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"
|
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 :comments, :order => "comments.id", :dependent => :destroy
|
||||||
has_many :children, :class_name => "Post", :foreign_key => "parent_id", :order => "posts.id"
|
has_many :children, :class_name => "Post", :foreign_key => "parent_id", :order => "posts.id"
|
||||||
has_many :disapprovals, :class_name => "PostDisapproval", :dependent => :destroy
|
has_many :disapprovals, :class_name => "PostDisapproval", :dependent => :destroy
|
||||||
has_many :favorites
|
has_many :favorites, :dependent => :destroy
|
||||||
validates_uniqueness_of :md5
|
validates_uniqueness_of :md5
|
||||||
validate :post_is_not_its_own_parent
|
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]
|
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]
|
||||||
|
|||||||
Reference in New Issue
Block a user