Sha256: 1c263094f28d601938875b9eecd06e60834572b668d4f558a562d015713c815e

Contents?: true

Size: 824 Bytes

Versions: 65

Compression:

Stored size: 824 Bytes

Contents

# DEPRECATED MODEL, NOT USED ANY MORE
class CamaleonCms::PostRelationship < ActiveRecord::Base
  self.table_name = "#{PluginRoutes.static_system_info["db_prefix"]}term_relationships"
  # attr_accessible :objectid, :term_taxonomy_id, :term_order
  default_scope ->{ order(term_order: :asc) }

  belongs_to :post_type, :class_name => "CamaleonCms::PostType", foreign_key: :term_taxonomy_id, inverse_of: :post_relationships
  belongs_to :posts, ->{ order("#{CamaleonCms::Post.table_name}.id DESC") }, :class_name => "CamaleonCms::Post", foreign_key: :objectid, inverse_of: :post_relationships, dependent: :destroy

  # callbacks
  after_create :update_count
  before_destroy :update_count

  private
  def update_count
    self.post_type.update_column('count', self.post_type.posts.size) if self.post_type.present?
  end

end

Version data entries

65 entries across 65 versions & 2 rubygems

Version Path
camaleon_cms-2.5.3.1 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.5.3 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.5.2 app/models/camaleon_cms/post_relationship.rb
camaleon_cms_rails6-2.5.0 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.5.1 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.5.0 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.6.9 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.6.8 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.6.7 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.6.6 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.6.5 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.6.4 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.6.3 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.6.2 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.6.1 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.6.0 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.5.14 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.5.13 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.5.12 app/models/camaleon_cms/post_relationship.rb
camaleon_cms-2.4.5.11 app/models/camaleon_cms/post_relationship.rb