Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'activerecord'
- ActiveRecord::Base.establish_connection(
- :adapter => "mysql",
- :host => "192.168.***.***",
- :username => "username",
- :password => "password",
- :database => "database",
- :socket => "/var/lib/mysql/mysql.sock",
- :encoding =>"utf8")
- ArAuto = Module.new
- ActiveRecord::Base.connection.tables.each do |table_name|
- eval("ArAuto::#{table_name.singularize.camelize} = Class.new(ActiveRecord::Base)")
- end
- # example for contents table
- p ArAuto::Content.find(:all,:limit=>3)
Add Comment
Please, Sign In to add comment