Created
September 25, 2011 20:41
-
-
Save philcrissman/1241129 to your computer and use it in GitHub Desktop.
derppress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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