Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- require 'rubygems'
- require 'active_record'
- require 'has_many_polymorphs'
- require 'logger'
- ActiveRecord::Base.establish_connection(
- :adapter => "mysql",
- :database => "NET",
- :username => "WEB",
- :password => "",
- :socket => "/var/run/mysqld/mysqld.sock")
- module Blah
- class Tagging < ActiveRecord::Base
- end
- class Gallery < ActiveRecord::Base
- end
- class Tag < ActiveRecord::Base
- end
- class Tag < ActiveRecord::Base
- has_many_polymorphs :taggables,
- :from => [:"blah/galleries"],
- :through => :"blah/taggings"
- end
- class Tagging < ActiveRecord::Base
- belongs_to :tag, :class_name => "Blah::Tag", :foreign_key => "tag_id"
- belongs_to :taggable, :polymorphic => true
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement