diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-17 04:22:17 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-17 06:39:23 +0300 |
commit | 4c305d4dd65643c30471eee5da580f27d87b5f2c (patch) | |
tree | f118fc09ca8ede6664fe0a0ef3d3bc6bb4a79bca | |
parent | b9d09a0c5ee43a58f2c19b37f590b2124bb10a25 (diff) |
Validate application settings only if column exists
-rw-r--r-- | app/models/application_setting.rb | 7 | ||||
-rw-r--r-- | db/schema.rb | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index d9c73559098..aed4068f309 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -1,6 +1,7 @@ class ApplicationSetting < ActiveRecord::Base validates :home_page_url, allow_blank: true, - format: { with: URI::regexp(%w(http https)), message: "should be a valid url" } + format: { with: URI::regexp(%w(http https)), message: "should be a valid url" }, + if: :home_page_url_column_exist def self.current ApplicationSetting.last @@ -15,4 +16,8 @@ class ApplicationSetting < ActiveRecord::Base sign_in_text: Settings.extra['sign_in_text'], ) end + + def home_page_url_column_exist + ActiveRecord::Base.connection.column_exists?(:application_settings, :home_page_url) + end end diff --git a/db/schema.rb b/db/schema.rb index 96f66ac3634..b453164d712 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -424,7 +424,6 @@ ActiveRecord::Schema.define(version: 20150116234544) do t.integer "notification_level", default: 1, null: false t.datetime "password_expires_at" t.integer "created_by_id" - t.datetime "last_credential_check_at" t.string "avatar" t.string "confirmation_token" t.datetime "confirmed_at" @@ -432,6 +431,7 @@ ActiveRecord::Schema.define(version: 20150116234544) do t.string "unconfirmed_email" t.boolean "hide_no_ssh_key", default: false t.string "website_url", default: "", null: false + t.datetime "last_credential_check_at" t.string "github_access_token" end |