mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
Merge pull request #484 from okriuchykhin/ok_SCI_1004
Add global settings base class [SCI-1004]
This commit is contained in:
commit
95af5001ab
2 changed files with 16 additions and 0 deletions
7
app/models/settings.rb
Normal file
7
app/models/settings.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Settings < ActiveRecord::Base
|
||||
@instance = first
|
||||
|
||||
def self.instance
|
||||
@instance ||= new
|
||||
end
|
||||
end
|
9
db/migrate/20170217141402_create_settings_table.rb
Normal file
9
db/migrate/20170217141402_create_settings_table.rb
Normal 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
|
Loading…
Reference in a new issue