Skip to content

Instantly share code, notes, and snippets.

@philcrissman
Created September 25, 2011 20:41
Show Gist options
  • Save philcrissman/1241129 to your computer and use it in GitHub Desktop.
Save philcrissman/1241129 to your computer and use it in GitHub Desktop.
derppress
module Wordpress
def acts_as_wordpress(options)
if ::Rails.env == "development"
establish_connection :wordpress_dev
elsif ::Rails.env == "test"
establish_connection :wordpress_test
elsif ::Rails.env == "production"
establish_connection :wordpress_production
else
establish_connection :wordpress_test
end
if options[:table_name]
set_table_name options[:table_name]
end
if options[:primary_key]
set_primary_key options[:primary_key]
end
end
end
ActiveRecord::Base.extend Wordpress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment