Sha256: a6e3aedbadc0fe7b6b7ad5a8b6190235f14c0ea2b860b92885d185f45f3cc559
Contents?: true
Size: 809 Bytes
Versions: 17
Compression:
Stored size: 809 Bytes
Contents
class CamaleonCms::TermRelationship < ActiveRecord::Base self.table_name = "#{PluginRoutes.static_system_info["db_prefix"]}term_relationships" default_scope ->{ order(term_order: :asc) } belongs_to :term_taxonomies, :class_name => "CamaleonCms::TermTaxonomy", foreign_key: :term_taxonomy_id, inverse_of: :term_relationships belongs_to :objects, ->{ order("#{CamaleonCms::Post.table_name}.id DESC") }, :class_name => "CamaleonCms::Post", foreign_key: :objectid, inverse_of: :term_relationships # callbacks after_create :update_count before_destroy :update_count private # update counter of post published items # TODO verify counter def update_count self.term_taxonomies.update_column('count', self.term_taxonomies.posts.published.size) if self.term_taxonomies.present? end end
Version data entries
17 entries across 17 versions & 1 rubygems