Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # to move data to drupal
- require 'activerecord'
- class ActiveRecord::Drupal < ActiveRecord::Base
- self.abstract_class = true
- establish_connection(
- :adapter => "mysql",
- :host => "localhost",
- :username => "root",
- :password => "",
- :database => "nm_drupal"
- )
- end
- class Vocabulary < ActiveRecord::Drupal
- set_table_name 'vocabulary'
- set_primary_key 'vid'
- has_many :terms, :foreign_key => :vid
- end
- class Node < ActiveRecord::Drupal
- set_table_name 'node'
- set_primary_key 'nid'
- end
- class NodeRevision < ActiveRecord::Drupal
- set_table_name 'node_revisions'
- set_primary_key 'vid'
- end
- class TermNode < ActiveRecord::Drupal
- set_table_name 'term_node'
- end
- class Term < ActiveRecord::Drupal
- set_table_name 'term_data'
- set_primary_key 'tid'
- belongs_to :vocabulary, :foreign_key => :vid
- end
- class ContentTypeListing < ActiveRecord::Drupal
- set_table_name 'content_type_listing'
- end
Add Comment
Please, Sign In to add comment