rails-settings-ui 0.5.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/app/controllers/rails_settings_ui/settings_controller.rb +15 -6
  4. data/app/helpers/rails_settings_ui/settings_helper.rb +1 -1
  5. data/app/views/layouts/rails_settings_ui/application.html.erb +26 -0
  6. data/app/views/rails_settings_ui/settings/index.html.erb +45 -0
  7. data/config/locales/en.yml +4 -2
  8. data/config/locales/ru.yml +4 -0
  9. data/config/locales/zh-CN.yml +4 -2
  10. data/config/locales/zh-TW.yml +4 -2
  11. data/lib/rails-settings-ui.rb +2 -1
  12. data/lib/rails-settings-ui/engine.rb +0 -2
  13. data/lib/rails-settings-ui/settings_form_coercible.rb +91 -0
  14. data/lib/rails-settings-ui/settings_form_validator.rb +62 -0
  15. data/lib/rails-settings-ui/version.rb +1 -1
  16. data/spec/dummy/app/models/settings.rb +3 -0
  17. data/spec/dummy/config/application.rb +1 -1
  18. data/spec/dummy/config/environments/production.rb +1 -1
  19. data/spec/dummy/config/environments/test.rb +3 -1
  20. data/spec/dummy/config/locales/en.yml +6 -1
  21. data/spec/dummy/log/test.log +27323 -0
  22. data/spec/dummy/tmp/cache/5B0/540/settings%3Amode +1 -0
  23. data/spec/dummy/tmp/cache/612/400/settings%3Aangle +1 -0
  24. data/spec/dummy/tmp/cache/62A/7E0/settings%3Alimit +1 -0
  25. data/spec/dummy/tmp/cache/62C/9C0/settings%3Atimer +1 -0
  26. data/spec/dummy/tmp/cache/63C/E80/settings%3Astyle +3 -0
  27. data/spec/dummy/tmp/cache/702/EF0/settings%3Acompany +1 -1
  28. data/spec/dummy/tmp/cache/8AF/EF0/settings%3Adescription +1 -0
  29. data/spec/dummy/tmp/cache/902/3E0/settings%3Aproject_name +2 -0
  30. data/spec/dummy/tmp/cache/A05/190/settings%3Aproject_status +1 -0
  31. data/spec/dummy/tmp/cache/A36/6E0/settings%3Acheck_something +1 -0
  32. data/spec/dummy/tmp/cache/AE1/750/rails_settings_cached%3Amode +1 -0
  33. data/spec/dummy/tmp/cache/B43/920/rails_settings_cached%3Aangle +1 -0
  34. data/spec/dummy/tmp/cache/B5B/D00/rails_settings_cached%3Alimit +1 -0
  35. data/spec/dummy/tmp/cache/B5D/EE0/rails_settings_cached%3Atimer +1 -0
  36. data/spec/dummy/tmp/cache/B6D/3A0/rails_settings_cached%3Astyle +3 -0
  37. data/spec/dummy/tmp/cache/DE0/670/rails_settings_cached%3Adescription +1 -0
  38. data/spec/dummy/tmp/cache/E33/F60/rails_settings_cached%3Aproject_name +2 -0
  39. data/spec/dummy/tmp/cache/F36/330/rails_settings_cached%3Aproject_status +1 -0
  40. data/spec/dummy/tmp/cache/F67/B90/rails_settings_cached%3Acheck_something +1 -0
  41. data/spec/dummy/tmp/capybara/capybara-201604072218331731576536.html +110 -0
  42. data/spec/dummy/tmp/capybara/capybara-201604081032444980849427.html +110 -0
  43. data/spec/dummy/tmp/capybara/capybara-201604081033515090839056.html +110 -0
  44. data/spec/dummy/tmp/capybara/capybara-201604081035235018036538.html +110 -0
  45. data/spec/dummy/tmp/capybara/capybara-201604081035456240700789.html +110 -0
  46. data/spec/dummy/tmp/capybara/capybara-201604171939409580658412.html +167 -0
  47. data/spec/dummy/tmp/capybara/capybara-201604172001578955442533.html +167 -0
  48. data/spec/dummy/tmp/capybara/capybara-201604172002367777806457.html +167 -0
  49. data/spec/dummy/tmp/capybara/capybara-201604172004318143886680.html +167 -0
  50. data/spec/dummy/tmp/capybara/capybara-201604172005177937139040.html +167 -0
  51. data/spec/dummy/tmp/capybara/capybara-201604172053441599257667.html +167 -0
  52. data/spec/dummy/tmp/capybara/capybara-20160417205725250944476.html +167 -0
  53. data/spec/dummy/tmp/capybara/capybara-201604172057331132801259.html +167 -0
  54. data/spec/dummy/tmp/capybara/capybara-201604172118071632087268.html +167 -0
  55. data/spec/dummy/tmp/capybara/capybara-201604172127076718204966.html +168 -0
  56. data/spec/dummy/tmp/capybara/capybara-20160417213155185601243.html +168 -0
  57. data/spec/dummy/tmp/capybara/capybara-201604172132268322962171.html +168 -0
  58. data/spec/dummy/tmp/capybara/capybara-201604172134068049534551.html +168 -0
  59. data/spec/dummy/tmp/capybara/capybara-201604172134532268725182.html +168 -0
  60. data/spec/dummy/tmp/capybara/capybara-20160417213510406143193.html +168 -0
  61. data/spec/dummy/tmp/capybara/capybara-201604172137188286690681.html +168 -0
  62. data/spec/dummy/tmp/capybara/capybara-20160417214102473521215.html +167 -0
  63. data/spec/dummy/tmp/capybara/capybara-201604172142356828149817.html +167 -0
  64. data/spec/dummy/tmp/capybara/capybara-201604172224448946017859.html +168 -0
  65. data/spec/dummy/tmp/capybara/capybara-201604180843098131092841.html +168 -0
  66. data/spec/dummy/tmp/capybara/capybara-201604180904356085374829.html +167 -0
  67. data/spec/dummy/tmp/capybara/capybara-201604181000253189634139.html +167 -0
  68. data/spec/dummy/tmp/capybara/capybara-201604182056589084036047.html +167 -0
  69. data/spec/features/settings_spec.rb +103 -24
  70. data/spec/lib/rails-settings-ui/settings_form_coercible_spec.rb +139 -0
  71. data/spec/lib/rails-settings-ui/settings_form_validator_spec.rb +96 -0
  72. data/spec/spec_helper.rb +1 -0
  73. metadata +146 -36
  74. data/app/views/layouts/rails_settings_ui/application.html.haml +0 -16
  75. data/app/views/rails_settings_ui/settings/index.html.haml +0 -25
  76. data/lib/rails-settings-ui/type_converter.rb +0 -60
  77. data/lib/rails-settings-ui/value_types/array.rb +0 -19
  78. data/lib/rails-settings-ui/value_types/base.rb +0 -30
  79. data/lib/rails-settings-ui/value_types/boolean.rb +0 -16
  80. data/lib/rails-settings-ui/value_types/duration.rb +0 -17
  81. data/lib/rails-settings-ui/value_types/fixnum.rb +0 -17
  82. data/lib/rails-settings-ui/value_types/float.rb +0 -17
  83. data/lib/rails-settings-ui/value_types/hash.rb +0 -19
  84. data/lib/rails-settings-ui/value_types/string.rb +0 -11
  85. data/lib/rails-settings-ui/value_types/symbol.rb +0 -11
  86. data/spec/lib/rails-settings-ui/type_converter_spec.rb +0 -33
  87. data/spec/lib/rails-settings-ui/value_types/array_spec.rb +0 -21
  88. data/spec/lib/rails-settings-ui/value_types/base_spec.rb +0 -23
  89. data/spec/lib/rails-settings-ui/value_types/boolean_spec.rb +0 -10
  90. data/spec/lib/rails-settings-ui/value_types/duration_spec.rb +0 -19
  91. data/spec/lib/rails-settings-ui/value_types/fixnum_spec.rb +0 -17
  92. data/spec/lib/rails-settings-ui/value_types/float_spec.rb +0 -17
  93. data/spec/lib/rails-settings-ui/value_types/hash_spec.rb +0 -26
  94. data/spec/lib/rails-settings-ui/value_types/string_spec.rb +0 -10
  95. data/spec/lib/rails-settings-ui/value_types/symbol_spec.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc72755cf22a10415d58b3854758ea9b01af316e
4
- data.tar.gz: 77a112f4085d266714e08ddcb1348998db01d11e
3
+ metadata.gz: bab5e19fe5e850b631020ca8ccfc9ff8cba996ec
4
+ data.tar.gz: 9e384e854a1b3c4c629e0e87a7f9aa762d63faae
5
5
  SHA512:
6
- metadata.gz: 987c8bafcca25d32509aec2de3f6f57b18ef12f35038bab3d0e8fde4c9d0e29447db29735196de32f3f6cda5f9ee33bd4909f59079121fde9b2291a9115c64ae
7
- data.tar.gz: 2cec2721aed657dd43a150adc1087e9cdbb34d5b5c90b2371ee9c998a74e0e0810d8d74a9ddab979326900c7f76b19aced1c9e13248bd9b9504b82b4dd0381fa
6
+ metadata.gz: ece5120593fd281428c267140d2d5bd3cd41e2bc98662d578b6b05e97e6da1e47afe4e7c38b17885e96b7aa53faf7f9e26375d6f35e5fcc1a437afd3198b15e9
7
+ data.tar.gz: c9d3fb1f08061341d93975810b5a327f28591159d468be439c71721d3213f28b07f9a260a13c9a9551f0aa2460aa671a4d67747674eafa4de14e152bbda4241d
data/Gemfile CHANGED
@@ -5,5 +5,4 @@ gemspec
5
5
  group :development, :test do
6
6
  gem "sqlite3"
7
7
  gem "rails-settings-cached"
8
- gem "haml-rails"
9
8
  end
@@ -1,16 +1,16 @@
1
1
  class RailsSettingsUi::SettingsController < RailsSettingsUi::ApplicationController
2
2
  include RailsSettingsUi::SettingsHelper
3
3
  before_filter :collection
4
- before_filter :cast_settings_params, only: :update_all
4
+ before_filter :validate_settings, only: :update_all
5
5
 
6
6
  def index
7
7
  end
8
8
 
9
9
  def update_all
10
- if @casted_settings[:errors].any?
10
+ if @errors.any?
11
11
  render :index
12
12
  else
13
- @casted_settings.map { |setting| RailsSettingsUi.settings_klass[setting[0]] = setting[1] if setting[0] != "errors" }
13
+ coerced_values.each { |name, value| RailsSettingsUi.settings_klass[name] = value }
14
14
  redirect_to [:settings]
15
15
  end
16
16
  end
@@ -18,12 +18,21 @@ class RailsSettingsUi::SettingsController < RailsSettingsUi::ApplicationControll
18
18
  private
19
19
 
20
20
  def collection
21
- all_settings = RailsSettingsUi.settings_klass.defaults.merge(RailsSettingsUi.settings_klass.public_send(get_collection_method))
21
+ all_settings = default_settings.merge(RailsSettingsUi.settings_klass.public_send(get_collection_method))
22
22
  all_settings_without_ignored = all_settings.reject{ |name, description| RailsSettingsUi.ignored_settings.include?(name.to_sym) }
23
23
  @settings = Hash[all_settings_without_ignored]
24
+ @errors = {}
24
25
  end
25
26
 
26
- def cast_settings_params
27
- @casted_settings = RailsSettingsUi::TypeConverter.cast(params["settings"])
27
+ def validate_settings
28
+ @errors = RailsSettingsUi::SettingsFormValidator.new(default_settings, params['settings'].deep_dup).errors
29
+ end
30
+
31
+ def coerced_values
32
+ RailsSettingsUi::SettingsFormCoercible.new(default_settings, params['settings'].deep_dup).coerce!
33
+ end
34
+
35
+ def default_settings
36
+ RailsSettingsUi.settings_klass.defaults
28
37
  end
29
38
  end
@@ -14,7 +14,7 @@ module RailsSettingsUi::SettingsHelper
14
14
  end
15
15
 
16
16
  def select_tag_field(setting_name, setting_value)
17
- default_setting_values = I18n.t("settings.attributes.#{setting_name}.labels", default: {}).map do |label, value|
17
+ default_setting_values = I18n.t("settings.attributes.#{setting_name}.labels", default: {}).map do |value, label|
18
18
  [label, value]
19
19
  end
20
20
  select_tag("settings[#{setting_name.to_s}]", options_for_select(default_setting_values, setting_value), class: 'form-control')
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <head>
4
+ <title>Rails settings</title>
5
+ <meta charset="utf-8"/>
6
+ <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/>
7
+ <meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport"/>
8
+ <%= csrf_meta_tags %>
9
+ </head>
10
+ <body>
11
+ <div class="container">
12
+ <div class="navbar navbar-default">
13
+ <div class="container-fluid">
14
+ <div class="navbar-header">
15
+ <a class="navbar-brand" href="/">Rails settings ui</a>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ <div class="row">
20
+ <%= yield %>
21
+ </div>
22
+ <footer></footer>
23
+ </div>
24
+ </body>
25
+ </html>
26
+
@@ -0,0 +1,45 @@
1
+ <ol class="breadcrumb">
2
+ <li class="active">
3
+ <%= t('settings.index.title') %>
4
+ </li>
5
+ </ol>
6
+ <% if @casted_settings && @casted_settings[:errors].any? %>
7
+ <div class="alert alert-danger">
8
+ <%= t('settings.index.settings_include_errors') %>
9
+ </div>
10
+ <% end %>
11
+ <%= form_tag [:update_all], method: :put, class: 'form' do %>
12
+ <table class="table table-striped">
13
+ <thead>
14
+ <tr>
15
+ <th>
16
+ <%= t('settings.index.description') %>
17
+ </th>
18
+ <th>
19
+ <%= t('settings.index.value') %>
20
+ </th>
21
+ </tr>
22
+ </thead>
23
+ <tbody>
24
+ <% @settings.each do |name, value| %>
25
+ <% errors = @errors.has_key?(name.to_sym) ? @errors[name.to_sym].join(', ') : nil %>
26
+ <tr data-name="<%= name %>">
27
+ <td>
28
+ <%= I18n.t("settings.attributes.#{name}.name") %>
29
+ </td>
30
+ <td class="setting-value">
31
+ <% setting_with_error = @casted_settings && @casted_settings[:errors].include?(name) %>
32
+ <div class="form-group <%= errors ? 'has-error' : '' %>">
33
+ <%= setting_field(name, value, @settings) %>
34
+ <span class="help-block">
35
+ <%= errors %>
36
+ </span>
37
+ </div>
38
+ </td>
39
+ </tr>
40
+ <% end %>
41
+ </tbody>
42
+ </table>
43
+ <%= submit_tag t('settings.index.save_all'), class: 'btn btn-primary btn-lg' %>
44
+ <% end %>
45
+
@@ -1,4 +1,8 @@
1
1
  en:
2
+ errors:
3
+ form_hash?: Invalid hash
4
+ int?: Invalid numeric
5
+ float?: Invalid numeric
2
6
  settings:
3
7
  index:
4
8
  title: Settings
@@ -7,6 +11,4 @@ en:
7
11
  save_all: Save all
8
12
  settings_include_errors: Settings include errors
9
13
  errors:
10
- invalid_numeric: Invalid numeric
11
- invalid_hash: Invalid hash
12
14
  default_missing: Default value missing, but exists in db
@@ -1,4 +1,8 @@
1
1
  ru:
2
+ errors:
3
+ form_hash?: Невалидный хэш
4
+ int?: Невалидный формат числа
5
+ float?: Невалидный формат числа
2
6
  settings:
3
7
  index:
4
8
  title: Настройки
@@ -1,4 +1,8 @@
1
1
  zh-CN:
2
+ errors:
3
+ form_hash?: 无效的 hash
4
+ int?: 无效的数字
5
+ float?: 无效的数字
2
6
  settings:
3
7
  index:
4
8
  title: 设置
@@ -7,6 +11,4 @@ zh-CN:
7
11
  save_all: 全部保存
8
12
  settings_include_errors: 设置含有错误
9
13
  errors:
10
- invalid_numeric: 无效的数字
11
- invalid_hash: 无效的 hash
12
14
  default_missing: 数据库中包含此项,但没找到默认值設定
@@ -1,4 +1,8 @@
1
1
  zh-TW:
2
+ errors:
3
+ form_hash?: 無效的 hash
4
+ int?: 無效的數字
5
+ float?: 無效的數字
2
6
  settings:
3
7
  index:
4
8
  title: 設置
@@ -7,6 +11,4 @@ zh-TW:
7
11
  save_all: 全部保存
8
12
  settings_include_errors: 設置包含錯誤
9
13
  errors:
10
- invalid_numeric: 無效的數字
11
- invalid_hash: 無效的 hash
12
14
  default_missing: 數據庫中包含此項,但沒有找到默認值設定
@@ -3,7 +3,8 @@ require 'rails-settings-ui/engine'
3
3
  require 'rails-settings-ui/main_app_route_delegator'
4
4
  require 'rails-settings-ui/version'
5
5
 
6
- require "rails-settings-ui/type_converter"
6
+ require "rails-settings-ui/settings_form_validator"
7
+ require "rails-settings-ui/settings_form_coercible"
7
8
 
8
9
  module RailsSettingsUi
9
10
  mattr_accessor :parent_controller
@@ -1,5 +1,3 @@
1
- require 'haml-rails'
2
-
3
1
  module ::RailsSettingsUi
4
2
  class Engine < Rails::Engine
5
3
  isolate_namespace RailsSettingsUi
@@ -0,0 +1,91 @@
1
+ require 'dry-types'
2
+
3
+ module RailsSettingsUi
4
+ module Types
5
+ include Dry::Types.module
6
+
7
+ module CustomCoercions
8
+
9
+ class Symbol
10
+ def self.[](value)
11
+ value.to_sym
12
+ end
13
+ end
14
+
15
+ class Hash
16
+ def self.[](value)
17
+ JSON.parse(value.gsub(/\=\>/, ':'))
18
+ end
19
+ end
20
+
21
+ class Array
22
+ def self.[](value)
23
+ # array presented in checkboxes
24
+ case value.class.name
25
+ when 'Hash', 'ActiveSupport::HashWithIndifferentAccess'
26
+ value.keys.map!(&:to_sym)
27
+ when 'ActionController::Parameters'
28
+ value.select{ |_,v| v == 'on' }.keys.map!(&:to_sym)
29
+ else
30
+ # or in select tag
31
+ value.to_sym
32
+ end
33
+ end
34
+ end
35
+
36
+ end
37
+ end
38
+
39
+ class NotCoercibleError < StandardError;end
40
+
41
+ class SettingsFormCoercible
42
+ attr_reader :settings, :default_settings
43
+ attr_accessor :coerced_settings
44
+
45
+ COERCIONS_MAP = {
46
+ String => Types::Coercible::String,
47
+ Symbol => Types::CustomCoercions::Symbol,
48
+ Fixnum => Types::Form::Int,
49
+ ActiveSupport::HashWithIndifferentAccess => Types::CustomCoercions::Hash,
50
+ ActiveSupport::Duration => Types::Form::Int,
51
+ Float => Types::Form::Float,
52
+ Array => Types::CustomCoercions::Array,
53
+ FalseClass => Types::Form::Bool,
54
+ TrueClass => Types::Form::Bool
55
+ }.freeze
56
+
57
+ def initialize(default_settings, settings)
58
+ @default_settings = default_settings
59
+ @settings = settings
60
+ @coerced_settings = {}
61
+ end
62
+
63
+ def coerce!
64
+ settings.symbolize_keys.each do |name, value|
65
+ default_value_class = default_settings[name].class
66
+ coercible_type = COERCIONS_MAP[default_value_class]
67
+ raise NotCoercibleError, "can't coerce #{default_value_class}" unless coercible_type
68
+ coerced_settings[name] = coercible_type[value]
69
+ end
70
+ set_default_boolean_value!(coerced_settings)
71
+ coerced_settings
72
+ end
73
+
74
+ private
75
+
76
+ def set_default_boolean_value!(settings)
77
+ default_settings.each do |name, value|
78
+ setting_value = settings[name.to_sym]
79
+ next if setting_value.present?
80
+
81
+ settings[name.to_sym] = case value.class.name
82
+ when 'TrueClass', 'FalseClass'
83
+ false
84
+ when 'Array'
85
+ []
86
+ end
87
+ end
88
+ end
89
+
90
+ end
91
+ end
@@ -0,0 +1,62 @@
1
+ require 'i18n'
2
+ require 'dry-validation'
3
+
4
+ module RailsSettingsUi
5
+ class SettingsSchema < Dry::Validation::Schema::Form
6
+ end
7
+
8
+ module CustomPredicates
9
+ include Dry::Logic::Predicates
10
+
11
+ predicate(:form_hash?) do |value|
12
+ begin
13
+ JSON.parse(value.gsub(/\=\>/, ':'))
14
+ rescue JSON::ParserError => e
15
+ false
16
+ end
17
+ end
18
+ end
19
+
20
+ class SettingsFormValidator
21
+ VALIDATABLE_TYPES = {
22
+ Fixnum => :int?,
23
+ Float => :float?,
24
+ ActiveSupport::Duration => :int?,
25
+ ActiveSupport::HashWithIndifferentAccess => :form_hash?
26
+ }.freeze
27
+
28
+ def initialize(default_settings, settings)
29
+ @default_settings = default_settings
30
+ @settings = settings
31
+ build_validation_schema
32
+ end
33
+
34
+ def errors
35
+ @schema.call(@settings).messages
36
+ end
37
+
38
+ private
39
+
40
+ def build_validation_schema
41
+ v = Dry::Validation::Schema::Value.new
42
+
43
+ validatable_settings.each do |name, value|
44
+ predicate = VALIDATABLE_TYPES[value.class]
45
+ v.key(name.to_sym).required(predicate) if predicate
46
+ end
47
+
48
+ SettingsSchema.configure do |config|
49
+ config.rules = v.rules
50
+ config.messages = :i18n
51
+ config.predicates = CustomPredicates
52
+ end
53
+
54
+ @schema = SettingsSchema.new
55
+ end
56
+
57
+ def validatable_settings
58
+ @default_settings.select { |_, value| value.class.in?(VALIDATABLE_TYPES.keys) }
59
+ end
60
+
61
+ end
62
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsSettingsUi
2
- VERSION = '0.5.0'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -1,6 +1,7 @@
1
1
  class Settings < RailsSettings::CachedSettings
2
2
  defaults[:project_name] = "Dummy"
3
3
  defaults[:limit] = 150
4
+ defaults[:angle] = 0.5
4
5
  defaults[:style] = {
5
6
  border_color: 'e0e0e0',
6
7
  block_color: 'ffffff',
@@ -13,4 +14,6 @@ class Settings < RailsSettings::CachedSettings
13
14
  defaults[:check_something] = true
14
15
  defaults[:description] = "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful."
15
16
  defaults[:mode] = [:auto, :manual]
17
+ defaults[:timer] = 2.hours
18
+ defaults[:project_status] = :finished
16
19
  end
@@ -22,7 +22,7 @@ module Dummy
22
22
 
23
23
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
24
24
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
25
- # config.i18n.default_locale = :de
25
+ config.i18n.default_locale = :en
26
26
  end
27
27
  end
28
28
 
@@ -20,7 +20,7 @@ Dummy::Application.configure do
20
20
  # config.action_dispatch.rack_cache = true
21
21
 
22
22
  # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_assets = false
23
+ config.serve_static_files = false
24
24
 
25
25
  # Compress JavaScripts and CSS.
26
26
  config.assets.js_compressor = :uglifier
@@ -13,9 +13,11 @@ Dummy::Application.configure do
13
13
  config.eager_load = false
14
14
 
15
15
  # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_assets = true
16
+ config.serve_static_files = true
17
17
  config.static_cache_control = "public, max-age=3600"
18
18
 
19
+ config.active_record.raise_in_transactional_callbacks = true
20
+
19
21
  # Show full error reports and disable caching.
20
22
  config.consider_all_requests_local = true
21
23
  config.action_controller.perform_caching = false
@@ -25,4 +25,9 @@ en:
25
25
  attributes:
26
26
  check_something:
27
27
  name: Check This Out!
28
- help_block: You really should check it out!
28
+ help_block: You really should check it out!
29
+ mode:
30
+ name: 'Mode'
31
+ labels:
32
+ auto: 'Auto'
33
+ manual: 'Manual'