active_record_simple_execute 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/README.md +23 -34
- data/lib/active_record_simple_execute/version.rb +1 -1
- data/lib/active_record_simple_execute.rb +22 -20
- metadata +7 -69
- data/test/dummy_app/Rakefile +0 -7
- data/test/dummy_app/app/assets/config/manifest.js +0 -3
- data/test/dummy_app/app/assets/javascripts/application.js +0 -0
- data/test/dummy_app/app/assets/stylesheets/application.css +0 -3
- data/test/dummy_app/app/controllers/application_controller.rb +0 -3
- data/test/dummy_app/app/models/application_record.rb +0 -3
- data/test/dummy_app/app/models/post.rb +0 -3
- data/test/dummy_app/app/views/layouts/application.html.erb +0 -14
- data/test/dummy_app/config/application.rb +0 -70
- data/test/dummy_app/config/boot.rb +0 -10
- data/test/dummy_app/config/database.yml +0 -20
- data/test/dummy_app/config/environment.rb +0 -5
- data/test/dummy_app/config/environments/development.rb +0 -30
- data/test/dummy_app/config/environments/production.rb +0 -60
- data/test/dummy_app/config/environments/test.rb +0 -41
- data/test/dummy_app/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy_app/config/initializers/inflections.rb +0 -10
- data/test/dummy_app/config/initializers/mime_types.rb +0 -5
- data/test/dummy_app/config/initializers/secret_token.rb +0 -11
- data/test/dummy_app/config/initializers/session_store.rb +0 -8
- data/test/dummy_app/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy_app/config/locales/en.yml +0 -5
- data/test/dummy_app/config/routes.rb +0 -6
- data/test/dummy_app/config/secrets.yml +0 -22
- data/test/dummy_app/config.ru +0 -4
- data/test/dummy_app/db/migrate/20210128155312_set_up_test_tables.rb +0 -28
- data/test/dummy_app/db/test +0 -0
- data/test/dummy_app/db/test.sqlite3 +0 -0
- data/test/dummy_app/log/test.log +0 -612
- data/test/test_helper.rb +0 -43
- data/test/unit/active_record_simple_execute_test.rb +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0eceac39c7160f6176c6951721ab2eea654c308e6de1a5feb4ca26fd21badb9
|
4
|
+
data.tar.gz: 1c134afe71506b1dea030060b44f659cd351ff1ca28bdbd95736b8e53a896a22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6671f5c3f4cc84226b19c9613384ece86803854b0e4c943e31146aa34b49901a3afcd81ea24ccbc3437362ef71e54cdc9d58ab75877560e1ab5059b6b2a9f6cc
|
7
|
+
data.tar.gz: 2fb5d735c43a0f25a57f51bfb5db6e8d946ae8a5e109f3b3776879f2f8ffe7b4ae2e37ca72d02baf2c8def971a9a30728a0f94bed26d97475484052a82d093b7
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
---------
|
3
3
|
|
4
|
-
- Unreleased - [View Diff](https://github.com/westonganger/active_record_simple_execute/compare/v0.9.
|
4
|
+
- Unreleased - [View Diff](https://github.com/westonganger/active_record_simple_execute/compare/v0.9.1...master)
|
5
5
|
* Nothing yet
|
6
6
|
|
7
|
+
- v0.9.1 - [View Diff](https://github.com/westonganger/active_record_simple_execute/compare/v0.9.0...v0.9.1)
|
8
|
+
* [#1](https://github.com/westonganger/active_sort_order/pull/1) - Utilize active_record lazy loading
|
9
|
+
|
7
10
|
- v0.9.0 - May 20, 2021 - [View Diff](https://github.com/westonganger/active_record_simple_execute/compare/1546ce4...v0.9.0)
|
8
11
|
* Initial Release
|
data/README.md
CHANGED
@@ -2,23 +2,41 @@
|
|
2
2
|
|
3
3
|
<a href="https://badge.fury.io/rb/active_record_simple_execute" target="_blank"><img height="21" style='border:0px;height:21px;' border='0' src="https://badge.fury.io/rb/active_record_simple_execute.svg" alt="Gem Version"></a>
|
4
4
|
<a href='https://github.com/westonganger/active_record_simple_execute/actions' target='_blank'><img src="https://github.com/westonganger/active_record_simple_execute/workflows/Tests/badge.svg" style="max-width:100%;" height='21' style='border:0px;height:21px;' border='0' alt="CI Status"></a>
|
5
|
-
<a href='https://rubygems.org/gems/active_record_simple_execute' target='_blank'><img height='21' style='border:0px;height:21px;' src='https://
|
5
|
+
<a href='https://rubygems.org/gems/active_record_simple_execute' target='_blank'><img height='21' style='border:0px;height:21px;' src='https://img.shields.io/gem/dt/active_record_simple_execute?color=brightgreen&label=Rubygems%20Downloads' border='0' alt='RubyGems Downloads' /></a>
|
6
6
|
|
7
7
|
Sanitize and Execute your raw SQL queries in ActiveRecord and Rails with a much more intuitive and shortened syntax.
|
8
8
|
|
9
|
+
# Installation
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'active_record_simple_execute'
|
13
|
+
```
|
14
|
+
|
9
15
|
## Comparison with Plain ActiveRecord
|
10
16
|
|
11
17
|
As seen here using `simple_execute` is much easier to remember than all the hoops plain ActiveRecord makes you jump through.
|
12
18
|
|
13
|
-
|
19
|
+
### Using Simple Execute
|
14
20
|
```ruby
|
15
|
-
|
21
|
+
sql_str = <<~SQL.squish
|
22
|
+
SELECT * FROM orders
|
23
|
+
FROM orders
|
24
|
+
WHERE orders.company_id = :company_id AND orders.updated_by_user_id = :user_id
|
25
|
+
SQL
|
26
|
+
|
27
|
+
records = ActiveRecord::Base.simple_execute(sql_str, company_id: @company.id, user_id: @user.id)
|
16
28
|
```
|
17
29
|
|
18
|
-
|
30
|
+
### Using Plain ActiveRecord Syntax
|
19
31
|
```ruby
|
32
|
+
sql_str = <<~SQL.squish
|
33
|
+
SELECT *
|
34
|
+
FROM orders
|
35
|
+
WHERE orders.company_id = :company_id AND orders.updated_by_user_id = :user_id
|
36
|
+
SQL
|
37
|
+
|
20
38
|
### must use send because this method is private is Rails 5.1 only, Public in 5.0 and 5.2
|
21
|
-
sanitized_sql = ActiveRecord::Base.sanitize_sql_array([sql_str,
|
39
|
+
sanitized_sql = ActiveRecord::Base.sanitize_sql_array([sql_str, company_id: @company.id, user_id: @user.id])
|
22
40
|
|
23
41
|
results = ActiveRecord::Base.connection.execute(sanitized_sql)
|
24
42
|
|
@@ -43,35 +61,6 @@ end
|
|
43
61
|
return records
|
44
62
|
```
|
45
63
|
|
46
|
-
# Installation
|
47
|
-
|
48
|
-
```ruby
|
49
|
-
gem 'active_record_simple_execute'
|
50
|
-
```
|
51
|
-
|
52
|
-
# Usage
|
53
|
-
|
54
|
-
```ruby
|
55
|
-
### Example with plain SQL String
|
56
|
-
sql = <<~SQL.squish
|
57
|
-
SELECT *
|
58
|
-
FROM orders
|
59
|
-
WHERE orders.foo = 'bar'
|
60
|
-
SQL
|
61
|
-
|
62
|
-
results = ActiveRecord::Base.simple_execute(sql_str)
|
63
|
-
|
64
|
-
### Example with ActiveRecord SQL Variables
|
65
|
-
|
66
|
-
sql = <<~SQL.squish
|
67
|
-
SELECT *
|
68
|
-
FROM orders
|
69
|
-
WHERE orders.company_id = :company_id AND orders.updated_by_user_id = :user_id
|
70
|
-
SQL
|
71
|
-
|
72
|
-
results = ActiveRecord::Base.simple_execute(sql_str, company_id: @company.id, @user.id)
|
73
|
-
```
|
74
|
-
|
75
64
|
# Contributing
|
76
65
|
|
77
66
|
We test multiple versions of `Rails` using the `appraisal` gem. Please use the following steps to test using `appraisal`.
|
@@ -1,34 +1,36 @@
|
|
1
1
|
require "active_record_simple_execute/version"
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "active_support/lazy_load_hooks"
|
4
4
|
|
5
|
-
|
5
|
+
ActiveSupport.on_load(:active_record) do
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
ActiveRecord::Base.class_eval do
|
8
|
+
def self.simple_execute(sql_str, **sql_vars)
|
9
|
+
### must use send because this method is private is Rails 5.1 only, Public in 5.0 and 5.2
|
10
|
+
sanitized_sql = ActiveRecord::Base.send(:sanitize_sql_array, [sql_str, **sql_vars])
|
10
11
|
|
11
|
-
|
12
|
+
results = ActiveRecord::Base.connection.execute(sanitized_sql)
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
if defined?(PG::Result) && results.is_a?(PG::Result)
|
15
|
+
records = results.to_a
|
16
|
+
elsif defined?(Mysql2::Result) && results.is_a?(Mysql2::Result)
|
17
|
+
records = []
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
results.each do |row|
|
20
|
+
h = {}
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
results.fields.each_with_index do |field,i|
|
23
|
+
h[field] = row[i]
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
+
records << h
|
27
|
+
end
|
28
|
+
else
|
29
|
+
records = results
|
26
30
|
end
|
27
|
-
else
|
28
|
-
records = results
|
29
|
-
end
|
30
31
|
|
31
|
-
|
32
|
+
return records
|
33
|
+
end
|
32
34
|
end
|
33
35
|
|
34
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_simple_execute
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weston Ganger
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -136,44 +136,13 @@ files:
|
|
136
136
|
- Rakefile
|
137
137
|
- lib/active_record_simple_execute.rb
|
138
138
|
- lib/active_record_simple_execute/version.rb
|
139
|
-
- test/dummy_app/Rakefile
|
140
|
-
- test/dummy_app/app/assets/config/manifest.js
|
141
|
-
- test/dummy_app/app/assets/javascripts/application.js
|
142
|
-
- test/dummy_app/app/assets/stylesheets/application.css
|
143
|
-
- test/dummy_app/app/controllers/application_controller.rb
|
144
|
-
- test/dummy_app/app/models/application_record.rb
|
145
|
-
- test/dummy_app/app/models/post.rb
|
146
|
-
- test/dummy_app/app/views/layouts/application.html.erb
|
147
|
-
- test/dummy_app/config.ru
|
148
|
-
- test/dummy_app/config/application.rb
|
149
|
-
- test/dummy_app/config/boot.rb
|
150
|
-
- test/dummy_app/config/database.yml
|
151
|
-
- test/dummy_app/config/environment.rb
|
152
|
-
- test/dummy_app/config/environments/development.rb
|
153
|
-
- test/dummy_app/config/environments/production.rb
|
154
|
-
- test/dummy_app/config/environments/test.rb
|
155
|
-
- test/dummy_app/config/initializers/backtrace_silencers.rb
|
156
|
-
- test/dummy_app/config/initializers/inflections.rb
|
157
|
-
- test/dummy_app/config/initializers/mime_types.rb
|
158
|
-
- test/dummy_app/config/initializers/secret_token.rb
|
159
|
-
- test/dummy_app/config/initializers/session_store.rb
|
160
|
-
- test/dummy_app/config/initializers/wrap_parameters.rb
|
161
|
-
- test/dummy_app/config/locales/en.yml
|
162
|
-
- test/dummy_app/config/routes.rb
|
163
|
-
- test/dummy_app/config/secrets.yml
|
164
|
-
- test/dummy_app/db/migrate/20210128155312_set_up_test_tables.rb
|
165
|
-
- test/dummy_app/db/test
|
166
|
-
- test/dummy_app/db/test.sqlite3
|
167
|
-
- test/dummy_app/log/test.log
|
168
|
-
- test/test_helper.rb
|
169
|
-
- test/unit/active_record_simple_execute_test.rb
|
170
139
|
homepage: https://github.com/westonganger/active_record_simple_execute
|
171
140
|
licenses:
|
172
141
|
- MIT
|
173
142
|
metadata:
|
174
143
|
source_code_uri: https://github.com/westonganger/active_record_simple_execute
|
175
144
|
changelog_uri: https://github.com/westonganger/active_record_simple_execute/blob/master/CHANGELOG.md
|
176
|
-
post_install_message:
|
145
|
+
post_install_message:
|
177
146
|
rdoc_options: []
|
178
147
|
require_paths:
|
179
148
|
- lib
|
@@ -188,40 +157,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
157
|
- !ruby/object:Gem::Version
|
189
158
|
version: '0'
|
190
159
|
requirements: []
|
191
|
-
rubygems_version: 3.
|
192
|
-
signing_key:
|
160
|
+
rubygems_version: 3.3.7
|
161
|
+
signing_key:
|
193
162
|
specification_version: 4
|
194
163
|
summary: Sanitize and Execute your raw SQL queries in ActiveRecord and Rails with
|
195
164
|
a much more intuitive and shortened syntax.
|
196
|
-
test_files:
|
197
|
-
- test/unit/active_record_simple_execute_test.rb
|
198
|
-
- test/test_helper.rb
|
199
|
-
- test/dummy_app/app/models/application_record.rb
|
200
|
-
- test/dummy_app/app/models/post.rb
|
201
|
-
- test/dummy_app/app/controllers/application_controller.rb
|
202
|
-
- test/dummy_app/app/views/layouts/application.html.erb
|
203
|
-
- test/dummy_app/app/assets/config/manifest.js
|
204
|
-
- test/dummy_app/app/assets/javascripts/application.js
|
205
|
-
- test/dummy_app/app/assets/stylesheets/application.css
|
206
|
-
- test/dummy_app/config/secrets.yml
|
207
|
-
- test/dummy_app/config/routes.rb
|
208
|
-
- test/dummy_app/config/locales/en.yml
|
209
|
-
- test/dummy_app/config/environments/production.rb
|
210
|
-
- test/dummy_app/config/environments/development.rb
|
211
|
-
- test/dummy_app/config/environments/test.rb
|
212
|
-
- test/dummy_app/config/environment.rb
|
213
|
-
- test/dummy_app/config/application.rb
|
214
|
-
- test/dummy_app/config/database.yml
|
215
|
-
- test/dummy_app/config/boot.rb
|
216
|
-
- test/dummy_app/config/initializers/backtrace_silencers.rb
|
217
|
-
- test/dummy_app/config/initializers/mime_types.rb
|
218
|
-
- test/dummy_app/config/initializers/session_store.rb
|
219
|
-
- test/dummy_app/config/initializers/wrap_parameters.rb
|
220
|
-
- test/dummy_app/config/initializers/secret_token.rb
|
221
|
-
- test/dummy_app/config/initializers/inflections.rb
|
222
|
-
- test/dummy_app/config.ru
|
223
|
-
- test/dummy_app/Rakefile
|
224
|
-
- test/dummy_app/db/test
|
225
|
-
- test/dummy_app/db/test.sqlite3
|
226
|
-
- test/dummy_app/db/migrate/20210128155312_set_up_test_tables.rb
|
227
|
-
- test/dummy_app/log/test.log
|
165
|
+
test_files: []
|
data/test/dummy_app/Rakefile
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
-
|
5
|
-
require File.expand_path('../config/application', __FILE__)
|
6
|
-
|
7
|
-
Dummy::Application.load_tasks
|
File without changes
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'warning'
|
5
|
-
Warning.ignore(
|
6
|
-
%r{mail/parsers/address_lists_parser}, ### Hide mail gem warnings
|
7
|
-
)
|
8
|
-
rescue LoadError
|
9
|
-
# Do nothing
|
10
|
-
end
|
11
|
-
|
12
|
-
require 'rails/all'
|
13
|
-
|
14
|
-
Bundler.require
|
15
|
-
|
16
|
-
module Dummy
|
17
|
-
class Application < Rails::Application
|
18
|
-
# Settings in config/environments/* take precedence over those specified here.
|
19
|
-
# Application configuration should go into files in config/initializers
|
20
|
-
# -- all .rb files in that directory are automatically loaded.
|
21
|
-
|
22
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
23
|
-
# config.autoload_paths += %W(#{config.root}/extras)
|
24
|
-
|
25
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
26
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
27
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
28
|
-
|
29
|
-
# Activate observers that should always be running.
|
30
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
31
|
-
|
32
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
33
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
34
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
35
|
-
|
36
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
37
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
38
|
-
# config.i18n.default_locale = :de
|
39
|
-
|
40
|
-
# Configure the default encoding used in templates for Ruby 1.9.
|
41
|
-
config.encoding = "utf-8"
|
42
|
-
|
43
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
44
|
-
config.filter_parameters += [:password]
|
45
|
-
|
46
|
-
# Enable the asset pipeline
|
47
|
-
config.assets.enabled = true
|
48
|
-
|
49
|
-
config.assets.quiet = true
|
50
|
-
|
51
|
-
# Version of your assets, change this if you want to expire all your assets
|
52
|
-
config.assets.version = '1.0'
|
53
|
-
|
54
|
-
config.generators.test_framework = false
|
55
|
-
config.generators.helper = false
|
56
|
-
config.generators.stylesheets = false
|
57
|
-
config.generators.javascripts = false
|
58
|
-
|
59
|
-
config.after_initialize do
|
60
|
-
ActiveRecord::Migration.migrate(Rails.root.join("db/migrate/*").to_s)
|
61
|
-
end
|
62
|
-
|
63
|
-
if ActiveRecord.respond_to?(:gem_version)
|
64
|
-
gem_version = ActiveRecord.gem_version
|
65
|
-
if gem_version.to_s.start_with?("5.2.")
|
66
|
-
config.active_record.sqlite3.represent_boolean_as_integer = true
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
default: &default
|
2
|
-
<% if defined?(SQLite3) %>
|
3
|
-
adapter: sqlite3
|
4
|
-
database: db/test.sqlite3
|
5
|
-
|
6
|
-
<% elsif defined?(Mysql2) %>
|
7
|
-
adapter: mysql2
|
8
|
-
database: active_record_simple_execute_test
|
9
|
-
|
10
|
-
<% elsif defined?(PG) %>
|
11
|
-
adapter: postgresql
|
12
|
-
database: active_record_simple_execute_test
|
13
|
-
|
14
|
-
<% end %>
|
15
|
-
|
16
|
-
development:
|
17
|
-
<<: *default
|
18
|
-
|
19
|
-
test:
|
20
|
-
<<: *default
|
@@ -1,30 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the web server when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Log error messages when you accidentally call methods on nil.
|
10
|
-
config.whiny_nils = true
|
11
|
-
|
12
|
-
# Show full error reports and disable caching
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_controller.perform_caching = false
|
15
|
-
|
16
|
-
# Don't care if the mailer can't send
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
18
|
-
|
19
|
-
# Print deprecation notices to the Rails logger
|
20
|
-
config.active_support.deprecation = :log
|
21
|
-
|
22
|
-
# Only use best-standards-support built into browsers
|
23
|
-
config.action_dispatch.best_standards_support = :builtin
|
24
|
-
|
25
|
-
# Do not compress assets
|
26
|
-
config.assets.compress = false
|
27
|
-
|
28
|
-
# Expands the lines which load the assets
|
29
|
-
config.assets.debug = true
|
30
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# Code is not reloaded between requests
|
5
|
-
config.cache_classes = true
|
6
|
-
|
7
|
-
# Full error reports are disabled and caching is turned on
|
8
|
-
config.consider_all_requests_local = false
|
9
|
-
config.action_controller.perform_caching = true
|
10
|
-
|
11
|
-
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
-
config.serve_static_files = false
|
13
|
-
|
14
|
-
# Compress JavaScripts and CSS
|
15
|
-
config.assets.compress = true
|
16
|
-
|
17
|
-
# Don't fallback to assets pipeline if a precompiled asset is missed
|
18
|
-
config.assets.compile = false
|
19
|
-
|
20
|
-
# Generate digests for assets URLs
|
21
|
-
config.assets.digest = true
|
22
|
-
|
23
|
-
# Defaults to Rails.root.join("public/assets")
|
24
|
-
# config.assets.manifest = YOUR_PATH
|
25
|
-
|
26
|
-
# Specifies the header that your server uses for sending files
|
27
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
28
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
29
|
-
|
30
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
31
|
-
# config.force_ssl = true
|
32
|
-
|
33
|
-
# See everything in the log (default is :info)
|
34
|
-
# config.log_level = :debug
|
35
|
-
|
36
|
-
# Use a different logger for distributed setups
|
37
|
-
# config.logger = SyslogLogger.new
|
38
|
-
|
39
|
-
# Use a different cache store in production
|
40
|
-
# config.cache_store = :mem_cache_store
|
41
|
-
|
42
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
43
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
44
|
-
|
45
|
-
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
46
|
-
# config.assets.precompile += %w( search.js )
|
47
|
-
|
48
|
-
# Disable delivery errors, bad email addresses will be ignored
|
49
|
-
# config.action_mailer.raise_delivery_errors = false
|
50
|
-
|
51
|
-
# Enable threaded mode
|
52
|
-
# config.threadsafe!
|
53
|
-
|
54
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
55
|
-
# the I18n.default_locale when a translation can not be found)
|
56
|
-
config.i18n.fallbacks = true
|
57
|
-
|
58
|
-
# Send deprecation notices to registered listeners
|
59
|
-
config.active_support.deprecation = :notify
|
60
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = true
|
9
|
-
|
10
|
-
# Configure static asset server for tests with Cache-Control for performance
|
11
|
-
config.serve_static_files = true
|
12
|
-
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
13
|
-
|
14
|
-
# Log error messages when you accidentally call methods on nil
|
15
|
-
config.whiny_nils = true
|
16
|
-
|
17
|
-
# Show full error reports and disable caching
|
18
|
-
config.consider_all_requests_local = true
|
19
|
-
config.action_controller.perform_caching = false
|
20
|
-
|
21
|
-
# Raise exceptions instead of rendering exception templates
|
22
|
-
config.action_dispatch.show_exceptions = false
|
23
|
-
|
24
|
-
# Disable request forgery protection in test environment
|
25
|
-
config.action_controller.allow_forgery_protection = false
|
26
|
-
|
27
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
28
|
-
# The :test delivery method accumulates sent emails in the
|
29
|
-
# ActionMailer::Base.deliveries array.
|
30
|
-
config.action_mailer.delivery_method = :test
|
31
|
-
|
32
|
-
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
33
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
34
|
-
# like if you have constraints or database-specific column types
|
35
|
-
# config.active_record.schema_format = :sql
|
36
|
-
|
37
|
-
# Print deprecation notices to the stderr
|
38
|
-
config.active_support.deprecation = :stderr
|
39
|
-
|
40
|
-
config.eager_load = false
|
41
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
-
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
-
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Add new inflection rules using the following format
|
4
|
-
# (all these examples are active by default):
|
5
|
-
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
-
# inflect.singular /^(ox)en/i, '\1'
|
8
|
-
# inflect.irregular 'person', 'people'
|
9
|
-
# inflect.uncountable %w( fish sheep )
|
10
|
-
# end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
# Make sure the secret is at least 30 characters and all random,
|
6
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
|
8
|
-
gem_version = ActiveRecord.gem_version
|
9
|
-
if gem_version <= Gem::Version.new("5.1")
|
10
|
-
Dummy::Application.config.secret_token = '4f337f0063fbb4a724dd8da15419679300da990ae4f6c94d36c714a3cd07e9653fc42d902cf33a9b9449a28e7eb2673f928172d65a090fa3c9156d6beea8d16c'
|
11
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
|
4
|
-
|
5
|
-
# Use the database for sessions instead of the cookie-based default,
|
6
|
-
# which shouldn't be used to store highly confidential information
|
7
|
-
# (create the session table with "rails generate session_migration")
|
8
|
-
# Dummy::Application.config.session_store :active_record_store
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
#
|
3
|
-
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
-
# is enabled by default.
|
5
|
-
|
6
|
-
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
-
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json]
|
9
|
-
end
|
10
|
-
|
11
|
-
# Disable root element in JSON by default.
|
12
|
-
ActiveSupport.on_load(:active_record) do
|
13
|
-
self.include_root_in_json = false
|
14
|
-
end
|