diff --git a/vendor/plugins/has_settings/lib/has_settings.rb b/vendor/plugins/has_settings/lib/has_settings.rb index cb89e4a..d5d4da8 100644 --- a/vendor/plugins/has_settings/lib/has_settings.rb +++ b/vendor/plugins/has_settings/lib/has_settings.rb @@ -22,7 +22,7 @@ module ClassMethods # >> w.reload # >> w.settings["foo"] #=> "bar def has_settings - if ActiveRecord::Base.connection.table_exists?('has_settings_settings') + if database_setup? has_one :has_settings_setting, :as => "configurable" after_save :save_settings @@ -50,6 +50,15 @@ def has_settings end end end + + protected + def database_setup? + begin + connection = ActiveRecord::Base.connection + connection.table_exists?('has_settings_settings') ? true : false + rescue Mysql::Error + end + end end end