Merge pull request #484 from okriuchykhin/ok_SCI_1004

Add global settings base class [SCI-1004]
This commit is contained in:
okriuchykhin 2017-02-21 13:20:24 +01:00 committed by GitHub
commit 95af5001ab
2 changed files with 16 additions and 0 deletions

7
app/models/settings.rb Normal file
View file

@ -0,0 +1,7 @@
class Settings < ActiveRecord::Base
@instance = first
def self.instance
@instance ||= new
end
end

View file

@ -0,0 +1,9 @@
class CreateSettingsTable < ActiveRecord::Migration
def change
create_table :settings do |t|
t.text :type, null: false
t.jsonb :values, null: false, default: '{}'
end
add_index(:settings, :type, unique: true)
end
end