thecore_settings 1.1.15 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/Dockerfile +20 -0
  3. data/.devcontainer/devcontainer.json +33 -0
  4. data/.github/workflows/gempush.yml +34 -0
  5. data/.gitignore +542 -0
  6. data/.rakeTasks +7 -0
  7. data/.rspec +1 -0
  8. data/.ruby-version +1 -0
  9. data/.travis.yml +31 -0
  10. data/CHANGELOG.md +81 -0
  11. data/Gemfile +4 -0
  12. data/Gemfile.lock +275 -0
  13. data/LICENSE.txt +22 -0
  14. data/README.md +169 -0
  15. data/README.rdoc +68 -0
  16. data/Rakefile +6 -34
  17. data/app/assets/images/thecore_settings/.keep +0 -0
  18. data/app/assets/javascripts/thecore_settings/.keep +0 -0
  19. data/app/assets/stylesheets/thecore_settings/.keep +0 -0
  20. data/app/controllers/.keep +0 -0
  21. data/app/helpers/.keep +0 -0
  22. data/app/mailers/.keep +0 -0
  23. data/app/models/.keep +0 -0
  24. data/app/models/rails_admin_settings/setting.rb +77 -0
  25. data/app/views/.keep +0 -0
  26. data/app/views/rails_admin/main/_setting_value.html.haml +41 -0
  27. data/assets/javascripts/rails_admin/custom/thecore_settings.rb +2 -0
  28. data/bin/rails +13 -0
  29. data/config/locales/en.yml +29 -0
  30. data/config/locales/pt-BR.yml +28 -0
  31. data/config/locales/ru.yml +29 -0
  32. data/gemfiles/mongoid-6.0.gemfile +5 -0
  33. data/gemfiles/mongoid-6.3.gemfile +5 -0
  34. data/lib/generators/rails_admin_settings/migration_generator.rb +15 -0
  35. data/lib/generators/rails_admin_settings/templates/db/migrate/20161227101954_create_thecore_settings.rb +29 -0
  36. data/lib/generators/rails_admin_settings/templates/migration.rb +29 -0
  37. data/lib/thecore_settings/determine_mime_type.rb +193 -0
  38. data/lib/thecore_settings/dumper.rb +12 -0
  39. data/lib/thecore_settings/engine.rb +17 -3
  40. data/lib/thecore_settings/fallback.rb +21 -0
  41. data/lib/thecore_settings/hex_color_validator.rb +11 -0
  42. data/lib/thecore_settings/kinds.rb +34 -0
  43. data/lib/thecore_settings/mongoid.rb +19 -0
  44. data/lib/thecore_settings/namespaced.rb +210 -0
  45. data/lib/thecore_settings/processing.rb +217 -0
  46. data/lib/thecore_settings/rails_admin_config.rb +71 -0
  47. data/lib/thecore_settings/require_helpers.rb +86 -0
  48. data/lib/thecore_settings/settings.rb +95 -0
  49. data/lib/thecore_settings/storage/carrier_wave_uploader.rb +9 -0
  50. data/lib/thecore_settings/storage/shrine_uploader.rb +14 -0
  51. data/lib/thecore_settings/tasks.rb +35 -0
  52. data/lib/thecore_settings/uploads.rb +57 -0
  53. data/lib/thecore_settings/validation.rb +126 -0
  54. data/lib/thecore_settings/version.rb +1 -1
  55. data/lib/thecore_settings.rb +115 -123
  56. data/log/development.log +0 -0
  57. data/spec/advanced_usage_spec.rb +11 -0
  58. data/spec/carrierwave_spec.rb +41 -0
  59. data/spec/database_trickery_spec.rb +48 -0
  60. data/spec/defaults_spec.rb +87 -0
  61. data/spec/enabling_spec.rb +29 -0
  62. data/spec/factories/setting.rb +8 -0
  63. data/spec/label_spec.rb +16 -0
  64. data/spec/migration_spec.rb +20 -0
  65. data/spec/model_spec.rb +105 -0
  66. data/spec/namespaced_spec.rb +67 -0
  67. data/spec/paperclip_spec.rb +38 -0
  68. data/spec/settings_spec.rb +75 -0
  69. data/spec/shrine_spec.rb +34 -0
  70. data/spec/spec_helper.rb +85 -0
  71. data/spec/support/1024x768.gif +0 -0
  72. data/spec/support/database_cleaner.rb +10 -0
  73. data/spec/support/defaults.yml +23 -0
  74. data/spec/support/defaults_w_file.yml +19 -0
  75. data/spec/support/mongoid.rb +6 -0
  76. data/spec/support/mongoid.yml +6 -0
  77. data/spec/types_spec.rb +101 -0
  78. data/test/dummy/Rakefile +6 -0
  79. data/test/dummy/app/assets/config/manifest.js +4 -0
  80. data/test/dummy/app/assets/images/.keep +0 -0
  81. data/test/dummy/app/assets/javascripts/application.js +13 -0
  82. data/test/dummy/app/assets/javascripts/cable.js +13 -0
  83. data/test/dummy/app/assets/javascripts/channels/.keep +0 -0
  84. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  85. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  86. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  87. data/test/dummy/app/controllers/application_controller.rb +3 -0
  88. data/test/dummy/app/controllers/concerns/.keep +0 -0
  89. data/test/dummy/app/helpers/application_helper.rb +2 -0
  90. data/test/dummy/app/jobs/application_job.rb +2 -0
  91. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  92. data/test/dummy/app/models/application_record.rb +3 -0
  93. data/test/dummy/app/models/concerns/.keep +0 -0
  94. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  95. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  96. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  97. data/test/dummy/bin/bundle +3 -0
  98. data/test/dummy/bin/rails +4 -0
  99. data/test/dummy/bin/rake +4 -0
  100. data/test/dummy/bin/setup +34 -0
  101. data/test/dummy/bin/update +29 -0
  102. data/test/dummy/config/application.rb +15 -0
  103. data/test/dummy/config/boot.rb +5 -0
  104. data/test/dummy/config/cable.yml +9 -0
  105. data/test/dummy/config/database.yml +25 -0
  106. data/test/dummy/config/environment.rb +5 -0
  107. data/test/dummy/config/environments/development.rb +54 -0
  108. data/test/dummy/config/environments/production.rb +86 -0
  109. data/test/dummy/config/environments/test.rb +42 -0
  110. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  111. data/test/dummy/config/initializers/assets.rb +11 -0
  112. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  113. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  114. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  115. data/test/dummy/config/initializers/inflections.rb +16 -0
  116. data/test/dummy/config/initializers/mime_types.rb +4 -0
  117. data/test/dummy/config/initializers/new_framework_defaults.rb +24 -0
  118. data/test/dummy/config/initializers/session_store.rb +3 -0
  119. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  120. data/test/dummy/config/locales/en.yml +23 -0
  121. data/test/dummy/config/puma.rb +47 -0
  122. data/test/dummy/config/routes.rb +3 -0
  123. data/test/dummy/config/secrets.yml +22 -0
  124. data/test/dummy/config/spring.rb +6 -0
  125. data/test/dummy/config.ru +5 -0
  126. data/test/dummy/db/development.sqlite3 +0 -0
  127. data/test/dummy/lib/assets/.keep +0 -0
  128. data/test/dummy/log/.keep +0 -0
  129. data/test/dummy/log/development.log +16 -0
  130. data/test/dummy/public/404.html +67 -0
  131. data/test/dummy/public/422.html +67 -0
  132. data/test/dummy/public/500.html +66 -0
  133. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  134. data/test/dummy/public/apple-touch-icon.png +0 -0
  135. data/test/dummy/public/favicon.ico +0 -0
  136. data/test/dummy/tmp/.keep +0 -0
  137. data/test/integration/navigation_test.rb +8 -0
  138. data/test/test_helper.rb +19 -0
  139. data/test/thecore_settings_test.rb +7 -0
  140. data/thecore_settings.gemspec +44 -0
  141. metadata +457 -54
data/README.rdoc ADDED
@@ -0,0 +1,68 @@
1
+ === Rails Admin
2
+
3
+ Since 1.4.7, it is the user's responsibility to create assets/javascripts/rails_admin/custom/ui.js and include rich
4
+
5
+ //= require rich/base
6
+
7
+ To use Rich in your RA forms, use the following in your initializer:
8
+
9
+ config.model Post do
10
+ edit do
11
+ field :title
12
+ field :body, :rich_editor do
13
+ config({
14
+ :insert_many => true
15
+ })
16
+ end
17
+ end
18
+ end
19
+
20
+ To use the image picker on a string field, do this:
21
+
22
+ field :title, :rich_picker do
23
+ config({
24
+ :allowed_styles => [:original],
25
+ :view_mode => "list"
26
+ })
27
+ end
28
+
29
+ == Rich in production mode
30
+
31
+ Rich works just fine in production mode. To accommodate the structure of the CKEditor source, Rich extends the <tt>assets:precompile</tt> task to make sure the full CKEditor source tree is copied to your assets folder. So the following works as you would expect:
32
+
33
+ rake assets:precompile
34
+
35
+ Rich will also clean up these CKEditor files when you clean your assets. Like this:
36
+
37
+ rake assets:clean
38
+
39
+ Although generally not necessary, the underlying Rich tasks can be invoked directly.
40
+
41
+ rake rich:assetize_ckeditor
42
+ rake rich:clean_ckeditor
43
+
44
+ == Configuration and overrides
45
+
46
+ Take a look at the generated <tt>rich.rb</tt> initializer and – if you want to dig deeper – the Rich sourcecode. The initializer guides you through the most important settings and configuration options.
47
+
48
+ === Localization
49
+
50
+ Localization should be automatic. Rich uses the currently set locale (<tt>I18n.locale</tt>) for it's editor and file browser.
51
+
52
+ === CKEditor configuration
53
+
54
+ Rich attempts to provide you with a sensible set of buttons and capabilities. But of course, you might disagree. To that end, you can configure CKEditor through the <tt>config</tt> directive, either globally through the initializer, or per editor instance as an option.
55
+
56
+ Rich also includes a few settings that manipulate CKEditor settings, but are a bit easier to use. For example, you can set <tt>:allow_embeds</tt> to <tt>true</tt> to load a media embed plugin (think Youtube, Vimeo, etc.)
57
+
58
+ === Editor styles
59
+
60
+ When you run the generator a css file is created for you in <tt>app/assets/stylesheets/rich/editor.css</tt>. Use this stylesheet to define the contents of the Styles drop down in CKEditor.
61
+
62
+ === Image configuration & (re)processing
63
+
64
+ The styles you define in the initializer are passed to Paperclip directly, so the syntax is identical. See https://github.com/thoughtbot/paperclip/wiki/Thumbnail-Generation for more information. You can also set additional processing options using <tt>convert_options</tt>. See your Rich initializer for more information.
65
+
66
+ When you change styles after uploading files, you will need to re-process those old files. To accomplish this, run the following command (avoid the standard Paperclip task!).
67
+
68
+ rake rich:refresh_assets
data/Rakefile CHANGED
@@ -1,37 +1,9 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
1
+ require "bundler/gem_tasks"
6
2
 
7
- require 'rdoc/task'
3
+ require 'rspec/core/rake_task'
8
4
 
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'ThecoreSettings'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
5
+ desc 'Default: run specs.'
6
+ task :default => :spec
16
7
 
17
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
- load 'rails/tasks/engine.rake'
19
-
20
-
21
- load 'rails/tasks/statistics.rake'
22
-
23
-
24
-
25
- require 'bundler/gem_tasks'
26
-
27
- require 'rake/testtask'
28
-
29
- Rake::TestTask.new(:test) do |t|
30
- t.libs << 'lib'
31
- t.libs << 'test'
32
- t.pattern = 'test/**/*_test.rb'
33
- t.verbose = false
34
- end
35
-
36
-
37
- task default: :test
8
+ desc "Run specs"
9
+ RSpec::Core::RakeTask.new
File without changes
File without changes
File without changes
File without changes
data/app/helpers/.keep ADDED
File without changes
data/app/mailers/.keep ADDED
File without changes
data/app/models/.keep ADDED
File without changes
@@ -0,0 +1,77 @@
1
+ if ThecoreSettings.active_record?
2
+ module ThecoreSettings
3
+ class Setting < ActiveRecord::Base
4
+ end
5
+ end
6
+ end
7
+
8
+ module ThecoreSettings
9
+ class Setting
10
+ if ThecoreSettings.mongoid?
11
+ include ThecoreSettings::Mongoid
12
+ end
13
+
14
+ if ThecoreSettings.active_record?
15
+ self.table_name = "thecore_settings"
16
+ end
17
+
18
+ scope :enabled, -> { where(enabled: true) }
19
+ scope :ns, ->(ns) { where(ns: ns) }
20
+
21
+ include ThecoreSettings::RequireHelpers
22
+ include ThecoreSettings::Processing
23
+ include ThecoreSettings::Uploads
24
+ include ThecoreSettings::Validation
25
+
26
+ def disabled?
27
+ !enabled
28
+ end
29
+
30
+ def enabled?
31
+ enabled
32
+ end
33
+
34
+ def name
35
+ label.blank? ? key : label
36
+ end
37
+
38
+ def type
39
+ kind
40
+ end
41
+
42
+ def to_path
43
+ if value.nil?
44
+ nil
45
+ else
46
+ 'public' + URI.parse(value).path
47
+ end
48
+ end
49
+
50
+ def as_yaml(options = {})
51
+ v = {type: type, enabled: enabled, label: label}
52
+ if upload_type?
53
+ v[:value] = to_path
54
+ else
55
+ v[:value] = raw
56
+ end
57
+ v.stringify_keys!
58
+ v
59
+ end
60
+
61
+ # t = {_all: 'Все'}
62
+ if ::Settings.table_exists?
63
+ ::ThecoreSettings::Setting.pluck(:ns).uniq.each do |c|
64
+ s = "ns_#{c.gsub('-', '_')}".to_sym
65
+ scope s, -> { where(ns: c) }
66
+ # t[s] = c
67
+ end
68
+ end
69
+ # I18n.backend.store_translations(:ru, {admin: {scopes: {'thecore_settings/setting': t}}})
70
+
71
+ if Object.const_defined?('RailsAdmin')
72
+ include ThecoreSettings::RailsAdminConfig
73
+ else
74
+ puts "[thecore_settings] Rails Admin not detected -- put this gem after rails_admin in gemfile"
75
+ end
76
+ end
77
+ end
data/app/views/.keep ADDED
File without changes
@@ -0,0 +1,41 @@
1
+ - if ['string', 'integer', 'float', 'phone', 'email', 'address', 'url', 'domain'].include?(@object.type)
2
+ = form.text_field :raw, :value => field.value
3
+ - if @object.type == 'boolean'
4
+ = form.check_box :raw, {:value => field.value}, 'true', 'false'
5
+ - if @object.type == 'color'
6
+ = form.text_field :raw, :value => field.value, 'data-color' => true, style: "background-color: ##{field.value}"
7
+ - elsif %w(text simple_format simple_format_raw strip_tags yaml json phones).include?( @object.type )
8
+ = form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
9
+ - elsif @object.type == 'code' || @object.type == 'sanitize_code'
10
+ :ruby
11
+ js_data = {
12
+ csspath: asset_path('ckeditor/plugins/codemirror/css/codemirror.min.css'),
13
+ jspath: asset_path('ckeditor/plugins/codemirror/js/codemirror.min.js'),
14
+ options: {
15
+ mode: 'htmlmixed',
16
+ theme: 'monokai',
17
+ lineNumbers: true
18
+ },
19
+ locations: {
20
+ mode: asset_path('ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js'),
21
+ theme: asset_path('ckeditor/plugins/codemirror/theme/monokai.css')
22
+ }
23
+ }
24
+
25
+ = form.text_area field.method_name, field.html_attributes.reverse_merge(data: { richtext: 'codemirror', options: js_data.to_json }).reverse_merge({ value: field.form_value })
26
+ - elsif @object.type == 'html' || @object.type == 'sanitized' || @object.type == 'sanitize'
27
+ - if form.respond_to?(:cktext_area)
28
+ = javascript_include_tag "ckeditor/init"
29
+ = form.cktext_area :raw, :value => field.value, :rows => 10, :cols => 80
30
+ - elsif Object.const_defined?('Rich')
31
+ = form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
32
+
33
+ = javascript_include_tag "rich/base.js"
34
+ :javascript
35
+ var instance = CKEDITOR.instances['#{form.dom_id(field)}'];
36
+ if(instance) { CKEDITOR.remove(instance); }
37
+ CKEDITOR.replace('#{form.dom_id(field)}', #{Rich.options().to_json.html_safe});
38
+ - else
39
+ .alert.alert-error
40
+ = t('admin.settings.no_ckeditor_detected')
41
+ = form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
@@ -0,0 +1,2 @@
1
+ //= require rich/base
2
+
data/bin/rails ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
6
+ ENGINE_PATH = File.expand_path('../../lib/thecore_settings/engine', __FILE__)
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
10
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
11
+
12
+ require 'rails/all'
13
+ require 'rails/engine/commands'
@@ -0,0 +1,29 @@
1
+ en:
2
+ admin:
3
+ settings:
4
+ label: 'Settings'
5
+ no_ckeditor_detected: CKEditor not found &mdash; showing as text input
6
+ phone_invalid: Incorrect phone
7
+ phones_invalid: "Incorrect phone: %{phones}"
8
+ email_invalid: Incorrect email
9
+ yaml_invalid: Incorrect YAML
10
+ json_invalid: Incorrect JSON
11
+ color_invalid: Incorrect color
12
+ mongoid: &mongoid
13
+ models:
14
+ thecore_settings/setting: Settings
15
+ attributes:
16
+ thecore_settings/setting:
17
+ c_at: Created
18
+ u_at: Updated
19
+ enabled: Enabled
20
+ ns: Group
21
+ name: Name
22
+ key: Key
23
+ raw: Value
24
+ type: Type
25
+ kind: Type
26
+ label: Label
27
+ activerecord:
28
+ <<: *mongoid
29
+
@@ -0,0 +1,28 @@
1
+ pt-BR:
2
+ admin:
3
+ settings:
4
+ label: 'Configurações'
5
+ no_ckeditor_detected: CKEditor não encontrado &mdash; exibindo como texto simples
6
+ phone_invalid: Telefone incorreto
7
+ phones_invalid: "Telefone incorreto: %{phones}"
8
+ email_invalid: Email incorreto
9
+ yaml_invalid: YAML incorreto
10
+ json_invalid: JSON incorreto
11
+ color_invalid: Cor incorreta
12
+ mongoid: &mongoid
13
+ models:
14
+ thecore_settings/setting: Configurações
15
+ attributes:
16
+ thecore_settings/setting:
17
+ c_at: Criado
18
+ u_at: Atualizado
19
+ enabled: Ativado
20
+ ns: Grupo
21
+ name: Nome
22
+ key: Chave
23
+ raw: Valor
24
+ type: Tipo
25
+ kind: Tipo
26
+ label: Legenda
27
+ activerecord:
28
+ <<: *mongoid
@@ -0,0 +1,29 @@
1
+ ru:
2
+ admin:
3
+ settings:
4
+ label: 'Настройки'
5
+ no_ckeditor_detected: CKEditor не обнаружен &mdash; отображаю настройку как текстовое поле
6
+ phone_invalid: Неверный телефонный номер
7
+ phones_invalid: "Неверный телефонный номер: %{phones}"
8
+ email_invalid: Неверный email
9
+ yaml_invalid: Неверный синтаксис YAML
10
+ json_invalid: Неверный синтаксис JSON
11
+ color_invalid: Неверный цвет
12
+ mongoid: &mongoid
13
+ models:
14
+ thecore_settings/setting: Настройки
15
+ attributes:
16
+ thecore_settings/setting:
17
+ c_at: Создано
18
+ u_at: Обновлено
19
+ enabled: Включено
20
+ ns: Группа
21
+ name: Название
22
+ key: Ключ
23
+ raw: Значение
24
+ type: Тип
25
+ kind: Тип
26
+ label: Подпись
27
+ activerecord:
28
+ <<: *mongoid
29
+
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "mongoid", "~> 6.0.0"
4
+
5
+ gemspec path: "../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "mongoid", "~> 6.3.0"
4
+
5
+ gemspec path: "../"
@@ -0,0 +1,15 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/active_record'
3
+
4
+ module ThecoreSettings
5
+ class MigrationGenerator < Rails::Generators::Base
6
+ include ActiveRecord::Generators::Migration
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ desc 'RocketCMS migration generator'
10
+ def install
11
+ migration_template "migration.rb", "db/migrate/create_thecore_settings.rb"
12
+ end
13
+ end
14
+ end
15
+
@@ -0,0 +1,29 @@
1
+ class CreateThecoreSettings < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :thecore_settings do |t|
4
+ t.boolean :enabled, default: true
5
+ t.string :kind, null: false, default: 'string'
6
+ t.string :ns, default: 'main'
7
+ t.string :key, null: false
8
+ if Object.const_defined?('Geocoder')
9
+ t.float :latitude
10
+ t.float :longitude
11
+ end
12
+ t.text :raw
13
+ t.string :label
14
+ if defined?(Paperclip)
15
+ t.attachment :file
16
+ elsif defined?(CarrierWave)
17
+ t.string :file
18
+ elsif defined?(Shrine)
19
+ t.text :file_data
20
+
21
+ end
22
+ t.timestamps
23
+ end
24
+
25
+ add_index :thecore_settings, :key
26
+ add_index :thecore_settings, [:ns, :key], unique: true
27
+ end
28
+ end
29
+
@@ -0,0 +1,29 @@
1
+ class CreateThecoreSettings < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :thecore_settings do |t|
4
+ t.boolean :enabled, default: true
5
+ t.string :kind, null: false, default: 'string'
6
+ t.string :ns, default: 'main'
7
+ t.string :key, null: false
8
+ if Object.const_defined?('Geocoder')
9
+ t.float :latitude
10
+ t.float :longitude
11
+ end
12
+ t.text :raw
13
+ t.string :label
14
+ if defined?(Paperclip)
15
+ t.attachment :file
16
+ elsif defined?(CarrierWave)
17
+ t.string :file
18
+ elsif defined?(Shrine)
19
+ t.text :file_data
20
+
21
+ end
22
+ t.timestamps
23
+ end
24
+
25
+ add_index :thecore_settings, :key
26
+ add_index :thecore_settings, [:ns, :key], unique: true
27
+ end
28
+ end
29
+