Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

Commit

Permalink
Merge branch 'jamescook-master' into ansuz-core
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Adams committed Mar 12, 2009
2 parents 578ba30 + 4ef5e7f commit 8ea778b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion vendor/plugins/has_settings/lib/has_settings.rb
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 8ea778b

Please sign in to comment.