righter 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +28 -0
  4. data/app/models/righter_right.rb +75 -0
  5. data/app/models/righter_rights_righter_role.rb +4 -0
  6. data/app/models/righter_role.rb +82 -0
  7. data/app/models/righter_role_grant.rb +7 -0
  8. data/app/models/righter_roles_user.rb +2 -0
  9. data/db/migrate/20150910000000_create_righter_rights.rb +21 -0
  10. data/db/migrate/20150910000001_create_righter_roles.rb +20 -0
  11. data/db/migrate/20150910000002_righter_roles_righter_access_rights.rb +14 -0
  12. data/db/migrate/20150910000003_create_righter_roles_users.rb +14 -0
  13. data/lib/init.rb +1 -0
  14. data/lib/injections/righter_for_application_controller.rb +31 -0
  15. data/lib/injections/righter_for_resource.rb +110 -0
  16. data/lib/injections/righter_for_user.rb +186 -0
  17. data/lib/righter.rb +9 -0
  18. data/lib/righter/version.rb +3 -0
  19. data/lib/righter_error.rb +8 -0
  20. data/lib/tasks/righter_tasks.rake +4 -0
  21. data/test/dummy/README.rdoc +28 -0
  22. data/test/dummy/Rakefile +11 -0
  23. data/test/dummy/app/assets/javascripts/application.js +13 -0
  24. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  25. data/test/dummy/app/controllers/application_controller.rb +6 -0
  26. data/test/dummy/app/controllers/doors_controller.rb +23 -0
  27. data/test/dummy/app/helpers/application_helper.rb +2 -0
  28. data/test/dummy/app/models/door.rb +10 -0
  29. data/test/dummy/app/models/house.rb +7 -0
  30. data/test/dummy/app/models/player.rb +7 -0
  31. data/test/dummy/app/models/righter_roles_player.rb +2 -0
  32. data/test/dummy/app/models/user.rb +4 -0
  33. data/test/dummy/app/views/doors/show.html.erb +1 -0
  34. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  35. data/test/dummy/bin/bundle +3 -0
  36. data/test/dummy/bin/rails +4 -0
  37. data/test/dummy/bin/rake +4 -0
  38. data/test/dummy/bin/setup +29 -0
  39. data/test/dummy/config.ru +4 -0
  40. data/test/dummy/config/application.rb +25 -0
  41. data/test/dummy/config/boot.rb +5 -0
  42. data/test/dummy/config/database.yml +25 -0
  43. data/test/dummy/config/environment.rb +5 -0
  44. data/test/dummy/config/environments/development.rb +41 -0
  45. data/test/dummy/config/environments/production.rb +79 -0
  46. data/test/dummy/config/environments/test.rb +42 -0
  47. data/test/dummy/config/initializers/assets.rb +11 -0
  48. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  49. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  50. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  51. data/test/dummy/config/initializers/inflections.rb +16 -0
  52. data/test/dummy/config/initializers/mime_types.rb +4 -0
  53. data/test/dummy/config/initializers/session_store.rb +3 -0
  54. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  55. data/test/dummy/config/locales/en.yml +23 -0
  56. data/test/dummy/config/routes.rb +8 -0
  57. data/test/dummy/config/secrets.yml +22 -0
  58. data/test/dummy/db/migrate/20150911000000_create_players.rb +18 -0
  59. data/test/dummy/db/migrate/20150911000002_create_users_table.rb +15 -0
  60. data/test/dummy/db/migrate/20150911000003_create_doors.rb +14 -0
  61. data/test/dummy/db/migrate/20150911000004_create_houses.rb +13 -0
  62. data/test/dummy/db/migrate/20150911000005_add_house_reference_to_doors.rb +9 -0
  63. data/test/dummy/db/schema.rb +90 -0
  64. data/test/dummy/db/test.sqlite3 +0 -0
  65. data/test/dummy/log/development.log +35 -0
  66. data/test/dummy/log/test.log +117973 -0
  67. data/test/dummy/public/404.html +67 -0
  68. data/test/dummy/public/422.html +67 -0
  69. data/test/dummy/public/500.html +66 -0
  70. data/test/dummy/public/favicon.ico +0 -0
  71. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/0-mgT1BVDUIUlj7bJxvh7Ud3uSbC1DJf0Ok7Ehgieds.cache +1 -0
  72. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  73. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/9jPCqzZvmeFf31Rz8y3OEo8OQXEHVcwmLgkx0tXs-o8.cache +1 -0
  74. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +3 -0
  75. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/VTeG_7OBrkPzWFSh3MrTa0NSl2wOuJfTJ-XP7JqBG2w.cache +0 -0
  76. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/a2CYO1s9hME5T1pntwZMB7J6dYjS0zCmDxw_7zX1T14.cache +0 -0
  77. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/d71F8V8hdfF1jAttqkXKdizYR9PcM_zuKn_Lj_73gfE.cache +1 -0
  78. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/hCBjLjjeqhUCs4tdwCYlGcFA4xohMwurjmZx6OY1a7g.cache +0 -0
  79. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +3 -0
  80. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ifgPguUzTOUeqB0zW0GV8DL6HEvPpakIWAzNPVuCGW0.cache +1 -0
  81. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/j8yaH5wiyIN5a2xePYA_lQm39RgOQh27UiF5A7i6b28.cache +0 -0
  82. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/o2kqwqoUQ3gkgncZO1IWdVRzFD0wCSQ-HyL62cINFOU.cache +1 -0
  83. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
  84. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/pIwp2wi1sfaJlhiwzzvyyV0hKOihhYkP6709hRtpHxg.cache +0 -0
  85. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/pQIgTfLmEPykNamzxdqBww21SMT7YlZlZGy6hgQ6eVE.cache +1 -0
  86. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/td9wUl9SLRnSSgE2ZK_VqCzLxTkFiCW50KkOhE916Wo.cache +1 -0
  87. data/test/factories/doors.rb +10 -0
  88. data/test/factories/houses.rb +7 -0
  89. data/test/factories/players.rb +6 -0
  90. data/test/factories/righter_rights.rb +11 -0
  91. data/test/factories/righter_roles.rb +9 -0
  92. data/test/factories/users.rb +9 -0
  93. data/test/fixtures/players.yml +6 -0
  94. data/test/fixtures/righter_rights.yml +21 -0
  95. data/test/fixtures/righter_roles.yml +29 -0
  96. data/test/fixtures/users.yml +27 -0
  97. data/test/functional/doors_controller_test.rb +71 -0
  98. data/test/righter_test.rb +9 -0
  99. data/test/test_helper.rb +54 -0
  100. data/test/unit/righter_for_resource_test.rb +137 -0
  101. data/test/unit/righter_right_test.rb +74 -0
  102. data/test/unit/righter_role_test.rb +197 -0
  103. data/test/unit/righter_user_test.rb +271 -0
  104. metadata +271 -0
@@ -0,0 +1,186 @@
1
+ module RighterForUser
2
+ include ActionView::Helpers::TextHelper
3
+ extend ActiveSupport::Concern
4
+
5
+ # when includes into an ActiveRecord::Model, creates associations for both model and RighterRole
6
+ # class RighterRoleModel must exist
7
+ included do
8
+ model_sym = model_name.human(count: :many).to_s.underscore.to_sym
9
+ model_plural_name = ActiveModel::Naming.plural(self)
10
+ relation = "righter_roles_#{model_plural_name}".to_sym
11
+ join_class = "RighterRoles#{self}".constantize
12
+
13
+ # associate me with RighterRole
14
+ has_many :righter_roles, -> { uniq }, through: relation
15
+ has_many relation, dependent: :destroy
16
+
17
+ # associate RighterRole with me
18
+ RighterRole.send :has_many, relation, dependent: :destroy
19
+ RighterRole.send :has_many, model_sym, through: relation, class_name: to_s
20
+ RighterRole.send :has_many, model_plural_name.to_sym, through: relation, source: model_sym
21
+
22
+ # associate _join_class_
23
+ # FIXME: check for existing reflections?
24
+ join_class.send :belongs_to, :righter_role
25
+ join_class.send :belongs_to, model_name.to_s.underscore.to_sym
26
+ join_class.send :has_many, model_plural_name.to_sym
27
+ end
28
+
29
+ # @return [Array<RighterRight>}
30
+ # scope returning associated RighterrRights
31
+ def righter_rights
32
+ @@users_id ||= self.class.arel_table[:id]
33
+ @@right_id ||= RighterRight.arel_table[:id]
34
+ @@righter_user_class ||= ActiveModel::Naming.singular(self)
35
+ right_ids = RighterRight.joins(righter_roles: @@righter_user_class).where(@@users_id.eq(id)).select(@@right_id).collect &:id
36
+ RighterRight.where id: right_ids.uniq
37
+ end
38
+
39
+ def add_role(role)
40
+ RighterRight.clear_cache
41
+ if role.class != RighterRole
42
+ fail RighterError.new("User.add_role accepts only RighterRole instance as input (provided :#{role.class.inspect})")
43
+ end
44
+ righter_roles << role
45
+ save!
46
+ end
47
+
48
+ def remove_role(role)
49
+ RighterRight.clear_cache
50
+ if role.class != RighterRole
51
+ fail RighterError.new("User.add_role accepts only RighterRole instance as input (provided :#{role.class.inspect})")
52
+ end
53
+ righter_roles.delete role
54
+ end
55
+
56
+ def righter_accessible?(opts = {})
57
+ if opts[:resource]
58
+ righter_accessible_resource? opts
59
+
60
+ elsif opts[:role]
61
+ righter_accessible_role? opts[:role]
62
+
63
+ elsif opts[:right]
64
+ righter_accessible_right? opts[:right]
65
+
66
+ elsif opts[:controller] && opts[:action]
67
+ righter_accessible_ca? opts[:controller], opts[:action]
68
+
69
+ else
70
+ fail RighterError.new("User.righter_accessible? expects as parameter role/right/controller+action. provided: #{opts.inspect}")
71
+ end
72
+ end
73
+
74
+ def grantable_roles
75
+ righter_roles.collect(&:grantable_roles).flatten
76
+ end
77
+
78
+ # should we raise RighterError when user is trying to break the grant rules ?
79
+ def update_roles_with_respect_to_grants(list_of_roles)
80
+ user_who_is_updating_roles = User.current_user
81
+ user_whom_roles_will_be_updated = self
82
+
83
+ RighterRight.clear_cache
84
+
85
+ User.transaction do
86
+ remove_all_roles_which_can_be_granted
87
+
88
+ grantable_roles = user_who_is_updating_roles.grantable_roles
89
+ list_of_roles.each do |role|
90
+ if grantable_roles.include? role
91
+ user_whom_roles_will_be_updated.add_role role
92
+ end
93
+ end
94
+ end
95
+ end
96
+
97
+ def can?(right_name, resource)
98
+ righter_accessible_resource?(right: right_name, resource: resource)
99
+ end
100
+
101
+ private
102
+
103
+ def remove_all_roles_which_can_be_granted
104
+ user_who_is_updating_roles = User.current_user
105
+ user_whom_roles_will_be_updated = self
106
+
107
+ user_who_is_updating_roles.grantable_roles.each do |grantable_role|
108
+ if user_whom_roles_will_be_updated.righter_roles.include? grantable_role
109
+ user_whom_roles_will_be_updated.remove_role grantable_role
110
+ end
111
+ end
112
+ end
113
+
114
+ def righter_accessible_resource?(opts)
115
+ resource = opts[:resource]
116
+ fail RighterError('cannot check rights for nil resource') unless resource
117
+
118
+ unless opts[:right]
119
+ fail RighterError.new('option :right is missing - which right should be checked on a resource?')
120
+ end
121
+
122
+ unless resource.respond_to?(:righter_right)
123
+ fail RighterError('cannot check rights for resource which does not respond to righter_right method')
124
+ end
125
+
126
+ right = resource.righter_right(opts[:right], opts)
127
+ fail RighterError.new("cannot find resource right #{opts[:right].inspect} for resource #{opts[:resource].inspect}") unless right
128
+
129
+ _righter_accessible_right?(right)
130
+ end
131
+
132
+ def righter_accessible_role?(role_name)
133
+ unless [String, Symbol].include?(role_name.class)
134
+ fail RighterError.new('User.righter_accessible? :role expects role_name as input')
135
+ end
136
+ all_user_role_names = righter_roles.collect { |r| r.name.to_sym }
137
+ all_user_role_names.include? role_name
138
+ end
139
+
140
+ def righter_accessible_right?(right_name)
141
+ unless [String, Symbol].include?(right_name.class)
142
+ fail RighterError.new('User.righter_accessible? :right expects right_name as input')
143
+ end
144
+
145
+ r = RighterRight.cached_find_by_name right_name
146
+ fail RighterError.new("cannot find righter_right with name #{right_name.inspect}") unless r
147
+
148
+ _righter_accessible_right?(r)
149
+ end
150
+
151
+ def _righter_accessible_right?(right)
152
+ fail RighterError.new('no right provided!') unless right
153
+
154
+ righter_role_ids = RighterRightsRighterRole.where(righter_right_id: right.id).collect &:righter_role_id
155
+ user_role_ids = righter_roles.collect &:id
156
+
157
+ righter_role_ids.each do |righter_role_id|
158
+ return true if user_role_ids.include?(righter_role_id)
159
+ end
160
+
161
+ false
162
+ end
163
+
164
+ def righter_accessible_ca?(controller, action)
165
+ all_user_rights = righter_rights.where(controller: controller.to_s)
166
+ all_user_rights.each do |user_right|
167
+ if user_right.controller && user_right.actions
168
+ if user_right.controller.to_sym == controller
169
+ right_actions = user_right.actions.collect(&:to_sym)
170
+ return true if right_actions.include?(action)
171
+
172
+ right_actions.each do |right_action| # wildcards
173
+ return true if right_action.to_s == '*'
174
+ if right_action.to_s.include?('*')
175
+ regex = right_action.to_s.gsub('*', '(.*)').gsub('/', '\/')
176
+ regex_match_result = (action.match /#{regex}/)
177
+ return true unless regex_match_result.nil?
178
+ end
179
+ end
180
+ end
181
+ end
182
+ end
183
+
184
+ false
185
+ end
186
+ end
@@ -0,0 +1,9 @@
1
+ require "#{File.dirname(__FILE__)}/righter_error.rb"
2
+ require "#{File.dirname(__FILE__)}/injections/righter_for_application_controller.rb"
3
+ require "#{File.dirname(__FILE__)}/injections/righter_for_user.rb"
4
+ require "#{File.dirname(__FILE__)}/injections/righter_for_resource.rb"
5
+
6
+ module Righter
7
+ class Engine < Rails::Engine
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module Righter
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,8 @@
1
+ class RighterError < StandardError
2
+ end
3
+
4
+ class RighterArgumentError < StandardError
5
+ end
6
+
7
+ class RighterNoUserError < RighterError
8
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :righter do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,11 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
7
+
8
+ Rake::Task['db:migrate'].enhance do
9
+ ActiveRecord::Migrator.migrate File.expand_path('../../../db/migrate/', __FILE__)
10
+ Rake::Task['db:schema:dump'].invoke
11
+ end
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,6 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ include RighterForApplicationController
6
+ end
@@ -0,0 +1,23 @@
1
+ class DoorsController < ApplicationController
2
+ def show
3
+ @door = Door.find(params[:id])
4
+ end
5
+
6
+ def paint
7
+ @door = Door.find(params[:id])
8
+ enforce_resource_security(:paint, @door)
9
+ render :show
10
+ end
11
+
12
+ def change
13
+ @door = Door.find(params[:id])
14
+ enforce_resource_security(:change, @door)
15
+ render :show
16
+ end
17
+
18
+ def open
19
+ @door = Door.find(params[:id])
20
+ enforce_resource_security(:open, @door)
21
+ render :show
22
+ end
23
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,10 @@
1
+ class Door < ActiveRecord::Base
2
+ include RighterForResource
3
+
4
+ auto_manage_righter_right :paint
5
+ auto_manage_righter_right :change, auto_associate_roles: [:admin]
6
+ auto_manage_righter_right :open, auto_associate_roles: [:admin, :user]
7
+ auto_manage_righter_right :close, parent_right: ->(door) { door.house.righter_right(:build).name }
8
+
9
+ belongs_to :house
10
+ end
@@ -0,0 +1,7 @@
1
+ class House < ActiveRecord::Base
2
+ include RighterForResource
3
+
4
+ auto_manage_righter_right :build
5
+
6
+ has_many :doors
7
+ end
@@ -0,0 +1,7 @@
1
+ class Player < ActiveRecord::Base
2
+ include RighterForResource
3
+
4
+ def side
5
+ 'evil'
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ class RighterRolesPlayer < ActiveRecord::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class User < ActiveRecord::Base
2
+ include RighterForUser
3
+ cattr_accessor :current_user
4
+ end
@@ -0,0 +1 @@
1
+ <h1><%= @door.name %></h1>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts '== Installing dependencies =='
12
+ system 'gem install bundler --conservative'
13
+ system 'bundle check || bundle install'
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system 'bin/rake db:setup'
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system 'rm -f log/*'
25
+ system 'rm -rf tmp/cache'
26
+
27
+ puts "\n== Restarting application server =="
28
+ system 'touch tmp/restart.txt'
29
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,25 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ require 'righter'
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16
+ # config.time_zone = 'Central Time (US & Canada)'
17
+
18
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
+ # config.i18n.default_locale = :de
21
+
22
+ # Do not swallow errors in after_commit/after_rollback callbacks.
23
+ config.active_record.raise_in_transactional_callbacks = true
24
+ end
25
+ end