term_taxonomy.rb
上传用户:netsea168
上传日期:2022-07-22
资源大小:4652k
文件大小:1k
源码类别:

Ajax

开发平台:

Others

  1. module WP25
  2.   class TermTaxonomy < ActiveRecord::Base
  3.     set_table_name 'wp_term_taxonomy'
  4.     set_primary_key 'term_taxonomy_id'
  5.     establish_connection configurations['wp25']
  6.         
  7.     has_many :term_relationships, :foreign_key => 'term_taxonomy_id'
  8.     has_many :posts, :through => :term_relationships,
  9.              :class_name => 'WP25:Post'
  10.     
  11.     def term
  12.       WP25::Term.find_by_term_id(term_id)
  13.     end
  14.    
  15.     def self.prefix=(prefix)
  16.       set_table_name "#{prefix}_term_taxonomy"
  17.     end
  18.   end
  19. end