drape 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +27 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.rubocop.yml +1159 -0
- data/.travis.yml +14 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +230 -0
- data/CONTRIBUTING.md +20 -0
- data/Gemfile +16 -0
- data/Guardfile +26 -0
- data/LICENSE +7 -0
- data/README.md +592 -0
- data/Rakefile +76 -0
- data/drape.gemspec +31 -0
- data/gemfiles/5.0.gemfile +8 -0
- data/lib/drape.rb +63 -0
- data/lib/drape/automatic_delegation.rb +55 -0
- data/lib/drape/collection_decorator.rb +102 -0
- data/lib/drape/decoratable.rb +93 -0
- data/lib/drape/decoratable/equality.rb +26 -0
- data/lib/drape/decorated_association.rb +33 -0
- data/lib/drape/decorates_assigned.rb +44 -0
- data/lib/drape/decorator.rb +282 -0
- data/lib/drape/delegation.rb +13 -0
- data/lib/drape/factory.rb +91 -0
- data/lib/drape/finders.rb +36 -0
- data/lib/drape/helper_proxy.rb +43 -0
- data/lib/drape/helper_support.rb +5 -0
- data/lib/drape/lazy_helpers.rb +13 -0
- data/lib/drape/railtie.rb +69 -0
- data/lib/drape/tasks/test.rake +9 -0
- data/lib/drape/test/devise_helper.rb +30 -0
- data/lib/drape/test/minitest_integration.rb +6 -0
- data/lib/drape/test/rspec_integration.rb +20 -0
- data/lib/drape/test_case.rb +42 -0
- data/lib/drape/undecorate.rb +9 -0
- data/lib/drape/version.rb +3 -0
- data/lib/drape/view_context.rb +104 -0
- data/lib/drape/view_context/build_strategy.rb +46 -0
- data/lib/drape/view_helpers.rb +34 -0
- data/lib/generators/controller_override.rb +17 -0
- data/lib/generators/mini_test/decorator_generator.rb +20 -0
- data/lib/generators/mini_test/templates/decorator_spec.rb +4 -0
- data/lib/generators/mini_test/templates/decorator_test.rb +4 -0
- data/lib/generators/rails/decorator_generator.rb +36 -0
- data/lib/generators/rails/templates/decorator.rb +19 -0
- data/lib/generators/rspec/decorator_generator.rb +9 -0
- data/lib/generators/rspec/templates/decorator_spec.rb +4 -0
- data/lib/generators/test_unit/decorator_generator.rb +9 -0
- data/lib/generators/test_unit/templates/decorator_test.rb +4 -0
- data/spec/draper/collection_decorator_spec.rb +305 -0
- data/spec/draper/decoratable/equality_spec.rb +10 -0
- data/spec/draper/decoratable_spec.rb +203 -0
- data/spec/draper/decorated_association_spec.rb +85 -0
- data/spec/draper/decorates_assigned_spec.rb +70 -0
- data/spec/draper/decorator_spec.rb +828 -0
- data/spec/draper/factory_spec.rb +250 -0
- data/spec/draper/finders_spec.rb +165 -0
- data/spec/draper/helper_proxy_spec.rb +61 -0
- data/spec/draper/lazy_helpers_spec.rb +21 -0
- data/spec/draper/undecorate_spec.rb +19 -0
- data/spec/draper/view_context/build_strategy_spec.rb +116 -0
- data/spec/draper/view_context_spec.rb +160 -0
- data/spec/draper/view_helpers_spec.rb +8 -0
- data/spec/dummy/.gitignore +21 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +3 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +16 -0
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/javascripts/channels/.keep +0 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +5 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/posts_controller.rb +21 -0
- data/spec/dummy/app/decorators/mongoid_post_decorator.rb +4 -0
- data/spec/dummy/app/decorators/post_decorator.rb +59 -0
- data/spec/dummy/app/helpers/application_helper.rb +5 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/mailers/post_mailer.rb +18 -0
- data/spec/dummy/app/models/admin.rb +5 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/mongoid_post.rb +5 -0
- data/spec/dummy/app/models/post.rb +3 -0
- data/spec/dummy/app/models/user.rb +5 -0
- data/spec/dummy/app/views/layouts/application.html.erb +9 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/app/views/post_mailer/decorated_email.html.erb +31 -0
- data/spec/dummy/app/views/posts/_post.html.erb +40 -0
- data/spec/dummy/app/views/posts/show.html.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +9 -0
- data/spec/dummy/bin/rake +9 -0
- data/spec/dummy/bin/setup +34 -0
- data/spec/dummy/bin/spring +15 -0
- data/spec/dummy/bin/update +29 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/config/application.rb +21 -0
- data/spec/dummy/config/boot.rb +2 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +51 -0
- data/spec/dummy/config/environments/production.rb +91 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +6 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/callback_terminator.rb +6 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/devise.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/per_form_csrf_tokens.rb +4 -0
- data/spec/dummy/config/initializers/request_forgery_protection.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/ssl_options.rb +4 -0
- data/spec/dummy/config/initializers/to_time_preserves_timezone.rb +10 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/mongoid.yml +16 -0
- data/spec/dummy/config/puma.rb +47 -0
- data/spec/dummy/config/routes.rb +8 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/db/migrate/20121019115657_create_posts.rb +7 -0
- data/spec/dummy/db/schema.rb +19 -0
- data/spec/dummy/db/seeds.rb +2 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/lib/tasks/.keep +0 -0
- data/spec/dummy/lib/tasks/test.rake +16 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/dummy/spec/decorators/active_model_serializers_spec.rb +12 -0
- data/spec/dummy/spec/decorators/devise_spec.rb +64 -0
- data/spec/dummy/spec/decorators/helpers_spec.rb +21 -0
- data/spec/dummy/spec/decorators/post_decorator_spec.rb +66 -0
- data/spec/dummy/spec/decorators/spec_type_spec.rb +7 -0
- data/spec/dummy/spec/decorators/view_context_spec.rb +22 -0
- data/spec/dummy/spec/mailers/post_mailer_spec.rb +33 -0
- data/spec/dummy/spec/models/mongoid_post_spec.rb +8 -0
- data/spec/dummy/spec/models/post_spec.rb +6 -0
- data/spec/dummy/spec/shared_examples/decoratable.rb +26 -0
- data/spec/dummy/spec/spec_helper.rb +8 -0
- data/spec/dummy/test/controllers/.keep +0 -0
- data/spec/dummy/test/fixtures/.keep +0 -0
- data/spec/dummy/test/fixtures/files/.keep +0 -0
- data/spec/dummy/test/helpers/.keep +0 -0
- data/spec/dummy/test/integration/.keep +0 -0
- data/spec/dummy/test/mailers/.keep +0 -0
- data/spec/dummy/test/models/.keep +0 -0
- data/spec/dummy/test/test_helper.rb +10 -0
- data/spec/dummy/vendor/assets/javascripts/.keep +0 -0
- data/spec/dummy/vendor/assets/stylesheets/.keep +0 -0
- data/spec/generators/controller/controller_generator_spec.rb +24 -0
- data/spec/generators/decorator/decorator_generator_spec.rb +94 -0
- data/spec/integration/integration_spec.rb +68 -0
- data/spec/performance/active_record.rb +4 -0
- data/spec/performance/benchmark.rb +57 -0
- data/spec/performance/decorators.rb +41 -0
- data/spec/performance/models.rb +20 -0
- data/spec/spec_helper.rb +41 -0
- data/spec/support/dummy_app.rb +88 -0
- data/spec/support/matchers/have_text.rb +50 -0
- data/spec/support/shared_examples/decoratable_equality.rb +40 -0
- data/spec/support/shared_examples/view_helpers.rb +39 -0
- metadata +497 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
class PostDecorator < Drape::Decorator
|
2
|
+
# don't delegate_all here because it helps to identify things we
|
3
|
+
# have to delegate for ActiveModel compatibility
|
4
|
+
|
5
|
+
# need to delegate attribute methods for AM::Serialization
|
6
|
+
delegate :id, :created_at, :new_record?
|
7
|
+
|
8
|
+
def posted_date
|
9
|
+
if created_at.to_date == DateTime.now.utc.to_date
|
10
|
+
'Today'
|
11
|
+
else
|
12
|
+
'Not Today'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def path_with_model
|
17
|
+
h.post_path(object)
|
18
|
+
end
|
19
|
+
|
20
|
+
def path_with_id
|
21
|
+
h.post_path(id: id)
|
22
|
+
end
|
23
|
+
|
24
|
+
def url_with_model
|
25
|
+
h.post_url(object)
|
26
|
+
end
|
27
|
+
|
28
|
+
def url_with_id
|
29
|
+
h.post_url(id: id)
|
30
|
+
end
|
31
|
+
|
32
|
+
def link
|
33
|
+
h.link_to id.to_s, self
|
34
|
+
end
|
35
|
+
|
36
|
+
def truncated
|
37
|
+
h.truncate('Once upon a time in a world far far away', length: 17, separator: ' ')
|
38
|
+
end
|
39
|
+
|
40
|
+
def html_escaped
|
41
|
+
h.html_escape('<script>danger</script>')
|
42
|
+
end
|
43
|
+
|
44
|
+
def hello_world
|
45
|
+
h.hello_world
|
46
|
+
end
|
47
|
+
|
48
|
+
def goodnight_moon
|
49
|
+
h.goodnight_moon
|
50
|
+
end
|
51
|
+
|
52
|
+
def updated_at
|
53
|
+
:overridden
|
54
|
+
end
|
55
|
+
|
56
|
+
def persisted?
|
57
|
+
true
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class PostMailer < ApplicationMailer
|
2
|
+
# TODO: Check it
|
3
|
+
# Mailers don't import app/helpers automatically
|
4
|
+
helper :application
|
5
|
+
|
6
|
+
def decorated_email(post)
|
7
|
+
@post = post.decorate
|
8
|
+
mail to: 'to@example.com', subject: 'A decorated post'
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def goodnight_moon
|
14
|
+
'Goodnight, moon!'
|
15
|
+
end
|
16
|
+
|
17
|
+
helper_method :goodnight_moon
|
18
|
+
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<dl>
|
2
|
+
<dt>Environment:</dt>
|
3
|
+
<dd id="environment"><%= Rails.env %></dd>
|
4
|
+
|
5
|
+
<dt>Drape view context controller:</dt>
|
6
|
+
<dd id="controller"><%= Drape::ViewContext.current.controller.class %></dd>
|
7
|
+
|
8
|
+
<dt>Posted:</dt>
|
9
|
+
<dd id="posted_date"><%= @post.posted_date %></dd>
|
10
|
+
|
11
|
+
<dt>Built-in helpers:</dt>
|
12
|
+
<dd id="truncated"><%= @post.truncated %></dd>
|
13
|
+
|
14
|
+
<dt>Built-in private helpers:</dt>
|
15
|
+
<dd id="html_escaped"><%= @post.html_escaped %></dd>
|
16
|
+
|
17
|
+
<dt>Helpers from app/helpers:</dt>
|
18
|
+
<dd id="hello_world"><%= @post.hello_world %></dd>
|
19
|
+
|
20
|
+
<dt>Helpers from the controller:</dt>
|
21
|
+
<dd id="goodnight_moon"><%= @post.goodnight_moon %></dd>
|
22
|
+
|
23
|
+
<dt>URL with decorator:</dt>
|
24
|
+
<dd id="url_with_decorator"><%= post_url(@post) %></dd>
|
25
|
+
|
26
|
+
<dt>URL with model:</dt>
|
27
|
+
<dd id="url_with_model"><%= @post.url_with_model %></dd>
|
28
|
+
|
29
|
+
<dt>URL with id:</dt>
|
30
|
+
<dd id="url_with_id"><%= @post.url_with_id %></dd>
|
31
|
+
</dl>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<dl>
|
2
|
+
<dt>Environment:</dt>
|
3
|
+
<dd id="environment"><%= Rails.env %></dd>
|
4
|
+
|
5
|
+
<dt>Drape view context controller:</dt>
|
6
|
+
<dd id="controller"><%= Drape::ViewContext.current.controller.class %></dd>
|
7
|
+
|
8
|
+
<dt>Posted:</dt>
|
9
|
+
<dd id="posted_date"><%= post.posted_date %></dd>
|
10
|
+
|
11
|
+
<dt>Built-in helpers:</dt>
|
12
|
+
<dd id="truncated"><%= post.truncated %></dd>
|
13
|
+
|
14
|
+
<dt>Built-in private helpers:</dt>
|
15
|
+
<dd id="html_escaped"><%= post.html_escaped %></dd>
|
16
|
+
|
17
|
+
<dt>Helpers from app/helpers:</dt>
|
18
|
+
<dd id="hello_world"><%= post.hello_world %></dd>
|
19
|
+
|
20
|
+
<dt>Helpers from the controller:</dt>
|
21
|
+
<dd id="goodnight_moon"><%= post.goodnight_moon %></dd>
|
22
|
+
|
23
|
+
<dt>Path with decorator:</dt>
|
24
|
+
<dd id="path_with_decorator"><%= post_path(post) %></dd>
|
25
|
+
|
26
|
+
<dt>Path with model:</dt>
|
27
|
+
<dd id="path_with_model"><%= post.path_with_model %></dd>
|
28
|
+
|
29
|
+
<dt>Path with id:</dt>
|
30
|
+
<dd id="path_with_id"><%= post.path_with_id %></dd>
|
31
|
+
|
32
|
+
<dt>URL with decorator:</dt>
|
33
|
+
<dd id="url_with_decorator"><%= post_url(post) %></dd>
|
34
|
+
|
35
|
+
<dt>URL with model:</dt>
|
36
|
+
<dd id="url_with_model"><%= post.url_with_model %></dd>
|
37
|
+
|
38
|
+
<dt>URL with id:</dt>
|
39
|
+
<dd id="url_with_id"><%= post.url_with_id %></dd>
|
40
|
+
</dl>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render post %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
begin
|
3
|
+
load File.expand_path('../spring', __FILE__)
|
4
|
+
rescue LoadError => e
|
5
|
+
raise unless e.message.include?('spring')
|
6
|
+
end
|
7
|
+
APP_PATH = File.expand_path('../config/application', __dir__)
|
8
|
+
require_relative '../config/boot'
|
9
|
+
require 'rails/commands'
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a starting point to setup your application.
|
15
|
+
# Add necessary setup steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
# puts "\n== Copying sample files =="
|
22
|
+
# unless File.exist?('config/database.yml')
|
23
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
24
|
+
# end
|
25
|
+
|
26
|
+
puts "\n== Preparing database =="
|
27
|
+
system! 'bin/rails db:setup'
|
28
|
+
|
29
|
+
puts "\n== Removing old logs and tempfiles =="
|
30
|
+
system! 'bin/rails log:clear tmp:clear'
|
31
|
+
|
32
|
+
puts "\n== Restarting application server =="
|
33
|
+
system! 'bin/rails restart'
|
34
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# This file loads spring without using Bundler, in order to be fast.
|
4
|
+
# It gets overwritten when you run the `spring binstub` command.
|
5
|
+
|
6
|
+
unless defined?(Spring)
|
7
|
+
require 'rubygems'
|
8
|
+
require 'bundler'
|
9
|
+
|
10
|
+
if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
|
11
|
+
Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) }
|
12
|
+
gem 'spring', match[1]
|
13
|
+
require 'spring/binstub'
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a way to update your development environment automatically.
|
15
|
+
# Add necessary update steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
puts "\n== Updating database =="
|
22
|
+
system! 'bin/rails db:migrate'
|
23
|
+
|
24
|
+
puts "\n== Removing old logs and tempfiles =="
|
25
|
+
system! 'bin/rails log:clear tmp:clear'
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system! 'bin/rails restart'
|
29
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative 'boot'
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
require 'mongoid' if defined?(Mongoid)
|
5
|
+
require 'devise' if defined?(Devise)
|
6
|
+
require 'active_model_serializers'
|
7
|
+
|
8
|
+
# Require the gems listed in Gemfile, including any gems
|
9
|
+
# you've limited to :test, :development, or :production.
|
10
|
+
Bundler.require(*Rails.groups)
|
11
|
+
|
12
|
+
module Dummy
|
13
|
+
class Application < Rails::Application
|
14
|
+
# Settings in config/environments/* take precedence over those specified here.
|
15
|
+
# Application configuration should go into files in config/initializers
|
16
|
+
# -- all .rb files in that directory are automatically loaded.
|
17
|
+
|
18
|
+
config.action_controller.default_url_options = { host: 'test.host', port: nil }
|
19
|
+
config.action_mailer.default_url_options = { host: 'test.host' }
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|
@@ -0,0 +1,51 @@
|
|
1
|
+
Rails.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
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
|
15
|
+
# Enable/disable caching. By default caching is disabled.
|
16
|
+
if Rails.root.join('tmp/caching-dev.txt').exist?
|
17
|
+
config.action_controller.perform_caching = true
|
18
|
+
|
19
|
+
config.cache_store = :memory_store
|
20
|
+
config.public_file_server.headers = {
|
21
|
+
'Cache-Control' => 'public, max-age=172800'
|
22
|
+
}
|
23
|
+
else
|
24
|
+
config.action_controller.perform_caching = false
|
25
|
+
|
26
|
+
config.cache_store = :null_store
|
27
|
+
end
|
28
|
+
|
29
|
+
# Don't care if the mailer can't send.
|
30
|
+
config.action_mailer.raise_delivery_errors = false
|
31
|
+
|
32
|
+
config.action_mailer.perform_caching = false
|
33
|
+
|
34
|
+
# Print deprecation notices to the Rails logger.
|
35
|
+
config.active_support.deprecation = :log
|
36
|
+
|
37
|
+
# Raise an error on page load if there are pending migrations.
|
38
|
+
config.active_record.migration_error = :page_load
|
39
|
+
|
40
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
41
|
+
# This option may cause significant delays in view rendering with a large
|
42
|
+
# number of complex assets.
|
43
|
+
config.assets.debug = true
|
44
|
+
|
45
|
+
# Raises error for missing translations
|
46
|
+
# config.action_view.raise_on_missing_translations = true
|
47
|
+
|
48
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
49
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
50
|
+
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
51
|
+
end
|