This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge branch 'jamescook-master' into ansuz-core

  • Loading branch information...
Josh Adams
Josh Adams committed Mar 12, 2009
2 parents 578ba30 + 4ef5e7f commit 8ea778b7d98137a25064fb88e6af1a1a24fdfd92
Showing with 10 additions and 1 deletion.
  1. +10 −1 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

0 comments on commit 8ea778b

Please sign in to comment.