draper_new 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.rspec +2 -0
- data/.travis.yml +15 -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 +587 -0
- data/Rakefile +69 -0
- data/draper_new.gemspec +31 -0
- data/gemfiles/4.0.gemfile +3 -0
- data/gemfiles/4.1.gemfile +3 -0
- data/gemfiles/4.2.6.gemfile +3 -0
- data/gemfiles/4.2.gemfile +3 -0
- data/lib/draper.rb +63 -0
- data/lib/draper/automatic_delegation.rb +56 -0
- data/lib/draper/collection_decorator.rb +100 -0
- data/lib/draper/decoratable.rb +96 -0
- data/lib/draper/decoratable/equality.rb +26 -0
- data/lib/draper/decorated_association.rb +35 -0
- data/lib/draper/decorates_assigned.rb +44 -0
- data/lib/draper/decorator.rb +293 -0
- data/lib/draper/delegation.rb +13 -0
- data/lib/draper/factory.rb +91 -0
- data/lib/draper/finders.rb +37 -0
- data/lib/draper/helper_proxy.rb +44 -0
- data/lib/draper/helper_support.rb +5 -0
- data/lib/draper/lazy_helpers.rb +15 -0
- data/lib/draper/railtie.rb +70 -0
- data/lib/draper/tasks/test.rake +22 -0
- data/lib/draper/test/devise_helper.rb +30 -0
- data/lib/draper/test/minitest_integration.rb +6 -0
- data/lib/draper/test/rspec_integration.rb +20 -0
- data/lib/draper/test_case.rb +42 -0
- data/lib/draper/undecorate.rb +9 -0
- data/lib/draper/version.rb +3 -0
- data/lib/draper/view_context.rb +104 -0
- data/lib/draper/view_context/build_strategy.rb +48 -0
- data/lib/draper/view_helpers.rb +37 -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 +307 -0
- data/spec/draper/decoratable/equality_spec.rb +10 -0
- data/spec/draper/decoratable_spec.rb +202 -0
- data/spec/draper/decorated_association_spec.rb +84 -0
- data/spec/draper/decorates_assigned_spec.rb +71 -0
- data/spec/draper/decorator_spec.rb +816 -0
- data/spec/draper/factory_spec.rb +251 -0
- data/spec/draper/finders_spec.rb +166 -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 +154 -0
- data/spec/draper/view_helpers_spec.rb +8 -0
- data/spec/dummy/.rspec +2 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +4 -0
- data/spec/dummy/app/controllers/localized_urls.rb +5 -0
- data/spec/dummy/app/controllers/posts_controller.rb +20 -0
- data/spec/dummy/app/decorators/mongoid_post_decorator.rb +4 -0
- data/spec/dummy/app/decorators/post_decorator.rb +60 -0
- data/spec/dummy/app/helpers/application_helper.rb +5 -0
- data/spec/dummy/app/mailers/application_mailer.rb +3 -0
- data/spec/dummy/app/mailers/post_mailer.rb +19 -0
- data/spec/dummy/app/models/admin.rb +5 -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 +11 -0
- data/spec/dummy/app/views/post_mailer/decorated_email.html.erb +1 -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/rails +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +71 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +33 -0
- data/spec/dummy/config/environments/production.rb +57 -0
- data/spec/dummy/config/environments/test.rb +31 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +8 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/mongoid.yml +79 -0
- data/spec/dummy/config/routes.rb +9 -0
- data/spec/dummy/db/migrate/20121019115657_create_posts.rb +8 -0
- data/spec/dummy/db/schema.rb +21 -0
- data/spec/dummy/db/seeds.rb +2 -0
- data/spec/dummy/fast_spec/post_decorator_spec.rb +37 -0
- data/spec/dummy/lib/tasks/test.rake +16 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/spec/decorators/active_model_serializers_spec.rb +16 -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 +24 -0
- data/spec/dummy/spec/spec_helper.rb +8 -0
- data/spec/dummy/test/decorators/minitest/devise_test.rb +64 -0
- data/spec/dummy/test/decorators/minitest/helpers_test.rb +21 -0
- data/spec/dummy/test/decorators/minitest/spec_type_test.rb +52 -0
- data/spec/dummy/test/decorators/minitest/view_context_test.rb +24 -0
- data/spec/dummy/test/decorators/test_unit/devise_test.rb +64 -0
- data/spec/dummy/test/decorators/test_unit/helpers_test.rb +21 -0
- data/spec/dummy/test/decorators/test_unit/view_context_test.rb +24 -0
- data/spec/dummy/test/minitest_helper.rb +2 -0
- data/spec/dummy/test/test_helper.rb +3 -0
- data/spec/generators/controller/controller_generator_spec.rb +22 -0
- data/spec/generators/decorator/decorator_generator_spec.rb +92 -0
- data/spec/integration/integration_spec.rb +66 -0
- data/spec/performance/active_record.rb +4 -0
- data/spec/performance/benchmark.rb +55 -0
- data/spec/performance/decorators.rb +45 -0
- data/spec/performance/models.rb +20 -0
- data/spec/spec_helper.rb +41 -0
- data/spec/support/dummy_app.rb +85 -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 +420 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
class PostMailer < ApplicationMailer
|
2
|
+
default from: "from@example.com"
|
3
|
+
layout "application"
|
4
|
+
|
5
|
+
# Mailers don't import app/helpers automatically
|
6
|
+
helper :application
|
7
|
+
|
8
|
+
def decorated_email(post)
|
9
|
+
@post = post.decorate
|
10
|
+
mail to: "to@example.com", subject: "A decorated post"
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def goodnight_moon
|
16
|
+
"Goodnight, moon!"
|
17
|
+
end
|
18
|
+
helper_method :goodnight_moon
|
19
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render @post %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<dl>
|
2
|
+
<dt>Environment:</dt>
|
3
|
+
<dd id="environment"><%= Rails.env %></dd>
|
4
|
+
|
5
|
+
<dt>Draper view context controller:</dt>
|
6
|
+
<dd id="controller"><%= Draper::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,71 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
def attempt_require(file)
|
4
|
+
require file
|
5
|
+
rescue LoadError
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'rails/all'
|
9
|
+
require 'draper'
|
10
|
+
attempt_require 'mongoid'
|
11
|
+
attempt_require 'devise'
|
12
|
+
require 'active_model_serializers'
|
13
|
+
|
14
|
+
module Dummy
|
15
|
+
class Application < Rails::Application
|
16
|
+
# Settings in config/environments/* take precedence over those specified here.
|
17
|
+
# Application configuration should go into files in config/initializers
|
18
|
+
# -- all .rb files in that directory are automatically loaded.
|
19
|
+
|
20
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
21
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
22
|
+
|
23
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
24
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
25
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
26
|
+
|
27
|
+
# Activate observers that should always be running.
|
28
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
29
|
+
|
30
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
31
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
32
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
33
|
+
|
34
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
35
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
36
|
+
# config.i18n.default_locale = :de
|
37
|
+
|
38
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
39
|
+
config.encoding = "utf-8"
|
40
|
+
|
41
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
42
|
+
config.filter_parameters += [:password]
|
43
|
+
|
44
|
+
# Enable escaping HTML in JSON.
|
45
|
+
config.active_support.escape_html_entities_in_json = true
|
46
|
+
|
47
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
48
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
49
|
+
# like if you have constraints or database-specific column types
|
50
|
+
# config.active_record.schema_format = :sql
|
51
|
+
|
52
|
+
# Enforce whitelist mode for mass assignment.
|
53
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
54
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
55
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
56
|
+
# config.active_record.whitelist_attributes = true
|
57
|
+
|
58
|
+
# Enable the asset pipeline
|
59
|
+
# config.assets.enabled = true
|
60
|
+
|
61
|
+
# Version of your assets, change this if you want to expire all your assets
|
62
|
+
# config.assets.version = '1.0'
|
63
|
+
|
64
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
65
|
+
# The :test delivery method accumulates sent emails in the
|
66
|
+
# ActionMailer::Base.deliveries array.
|
67
|
+
config.action_mailer.delivery_method = :test
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
ActiveRecord::Migration.verbose = false
|
@@ -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
|
+
development:
|
7
|
+
adapter: sqlite3
|
8
|
+
database: db/development.sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
13
|
+
# re-generated from your development database when you run "rake".
|
14
|
+
# Do not set this db to the same as development or production.
|
15
|
+
test:
|
16
|
+
adapter: sqlite3
|
17
|
+
database: db/test.sqlite3
|
18
|
+
pool: 5
|
19
|
+
timeout: 5000
|
20
|
+
|
21
|
+
production:
|
22
|
+
adapter: sqlite3
|
23
|
+
database: db/production.sqlite3
|
24
|
+
pool: 5
|
25
|
+
timeout: 5000
|
@@ -0,0 +1,33 @@
|
|
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
|
+
# Show full error reports and disable caching
|
10
|
+
config.consider_all_requests_local = true
|
11
|
+
config.action_controller.perform_caching = false
|
12
|
+
|
13
|
+
# Print deprecation notices to the Rails logger
|
14
|
+
config.active_support.deprecation = :log
|
15
|
+
|
16
|
+
# Only use best-standards-support built into browsers
|
17
|
+
config.action_dispatch.best_standards_support = :builtin
|
18
|
+
|
19
|
+
config.eager_load = false
|
20
|
+
|
21
|
+
# Raise exception on mass assignment protection for Active Record models
|
22
|
+
# config.active_record.mass_assignment_sanitizer = :strict
|
23
|
+
|
24
|
+
# Log the query plan for queries taking more than this (works
|
25
|
+
# with SQLite, MySQL, and PostgreSQL)
|
26
|
+
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
27
|
+
|
28
|
+
# Do not compress assets
|
29
|
+
# config.assets.compress = false
|
30
|
+
|
31
|
+
# Expands the lines which load the assets
|
32
|
+
# config.assets.debug = true
|
33
|
+
end
|
@@ -0,0 +1,57 @@
|
|
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_assets = false
|
13
|
+
|
14
|
+
config.eager_load = true
|
15
|
+
|
16
|
+
# Defaults to nil and saved in location specified by config.assets.prefix
|
17
|
+
# config.assets.manifest = YOUR_PATH
|
18
|
+
|
19
|
+
# Specifies the header that your server uses for sending files
|
20
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
21
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
22
|
+
|
23
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
24
|
+
# config.force_ssl = true
|
25
|
+
|
26
|
+
# See everything in the log (default is :info)
|
27
|
+
# config.log_level = :debug
|
28
|
+
|
29
|
+
# Prepend all log lines with the following tags
|
30
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
31
|
+
|
32
|
+
# Use a different logger for distributed setups
|
33
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
34
|
+
|
35
|
+
# Use a different cache store in production
|
36
|
+
# config.cache_store = :mem_cache_store
|
37
|
+
|
38
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
39
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
40
|
+
|
41
|
+
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
42
|
+
# config.assets.precompile += %w( search.js )
|
43
|
+
|
44
|
+
# Enable threaded mode
|
45
|
+
# config.threadsafe!
|
46
|
+
|
47
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
48
|
+
# the I18n.default_locale when a translation can not be found)
|
49
|
+
config.i18n.fallbacks = true
|
50
|
+
|
51
|
+
# Send deprecation notices to registered listeners
|
52
|
+
config.active_support.deprecation = :notify
|
53
|
+
|
54
|
+
# Log the query plan for queries taking more than this (works
|
55
|
+
# with SQLite, MySQL, and PostgreSQL)
|
56
|
+
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
57
|
+
end
|
@@ -0,0 +1,31 @@
|
|
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_assets = true
|
12
|
+
# config.static_cache_control = "public, max-age=3600"
|
13
|
+
|
14
|
+
# Show full error reports and disable caching
|
15
|
+
config.consider_all_requests_local = true
|
16
|
+
config.action_controller.perform_caching = false
|
17
|
+
|
18
|
+
# Raise exceptions instead of rendering exception templates
|
19
|
+
config.action_dispatch.show_exceptions = false
|
20
|
+
|
21
|
+
# Disable request forgery protection in test environment
|
22
|
+
config.action_controller.allow_forgery_protection = false
|
23
|
+
|
24
|
+
# Raise exception on mass assignment protection for Active Record models
|
25
|
+
# config.active_record.mass_assignment_sanitizer = :strict
|
26
|
+
|
27
|
+
# Print deprecation notices to the stderr
|
28
|
+
config.active_support.deprecation = :stderr
|
29
|
+
|
30
|
+
config.eager_load = false
|
31
|
+
end
|
@@ -0,0 +1,7 @@
|
|
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!
|
@@ -0,0 +1,15 @@
|
|
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
|
11
|
+
#
|
12
|
+
# These inflection rules are supported but not enabled by default:
|
13
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
14
|
+
# inflect.acronym 'RESTful'
|
15
|
+
# end
|
@@ -0,0 +1,8 @@
|
|
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
|
+
Dummy::Application.config.secret_key_base = 'c2e3474d3816f60bf6dd0f3b983e7283c7ff5373e11a96935340b544a31964dbe5ee077136165ee2975e0005f5e80207c0059e6d5589699031242ba5a06dcb87'
|
8
|
+
Dummy::Application.config.secret_token = 'c2e3474d3816f60bf6dd0f3b983e7283c7ff5373e11a96935340b544a31964dbe5ee077136165ee2975e0005f5e80207c0059e6d5589699031242ba5a06dcb87'
|
@@ -0,0 +1,8 @@
|
|
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
|
@@ -0,0 +1,79 @@
|
|
1
|
+
development:
|
2
|
+
# Configure available database sessions. (required)
|
3
|
+
sessions:
|
4
|
+
# Defines the default session. (required)
|
5
|
+
default:
|
6
|
+
# Defines the name of the default database that Mongoid can connect to.
|
7
|
+
# (required).
|
8
|
+
database: dummy_development
|
9
|
+
# Provides the hosts the default session can connect to. Must be an array
|
10
|
+
# of host:port pairs. (required)
|
11
|
+
hosts:
|
12
|
+
- localhost:27017
|
13
|
+
options:
|
14
|
+
# Change whether the session persists in safe mode by default.
|
15
|
+
# (default: false)
|
16
|
+
# safe: false
|
17
|
+
|
18
|
+
# Change the default consistency model to :eventual or :strong.
|
19
|
+
# :eventual will send reads to secondaries, :strong sends everything
|
20
|
+
# to master. (default: :eventual)
|
21
|
+
# consistency: :eventual
|
22
|
+
|
23
|
+
# How many times Moped should attempt to retry an operation after
|
24
|
+
# failure. (default: 30)
|
25
|
+
# max_retries: 30
|
26
|
+
|
27
|
+
# The time in seconds that Moped should wait before retrying an
|
28
|
+
# operation on failure. (default: 1)
|
29
|
+
# retry_interval: 1
|
30
|
+
# Configure Mongoid specific options. (optional)
|
31
|
+
options:
|
32
|
+
# Configuration for whether or not to allow access to fields that do
|
33
|
+
# not have a field definition on the model. (default: true)
|
34
|
+
# allow_dynamic_fields: true
|
35
|
+
|
36
|
+
# Enable the identity map, needed for eager loading. (default: false)
|
37
|
+
# identity_map_enabled: false
|
38
|
+
|
39
|
+
# Includes the root model name in json serialization. (default: false)
|
40
|
+
# include_root_in_json: false
|
41
|
+
|
42
|
+
# Include the _type field in serializaion. (default: false)
|
43
|
+
# include_type_for_serialization: false
|
44
|
+
|
45
|
+
# Preload all models in development, needed when models use
|
46
|
+
# inheritance. (default: false)
|
47
|
+
# preload_models: false
|
48
|
+
|
49
|
+
# Protect id and type from mass assignment. (default: true)
|
50
|
+
# protect_sensitive_fields: true
|
51
|
+
|
52
|
+
# Raise an error when performing a #find and the document is not found.
|
53
|
+
# (default: true)
|
54
|
+
# raise_not_found_error: true
|
55
|
+
|
56
|
+
# Raise an error when defining a scope with the same name as an
|
57
|
+
# existing method. (default: false)
|
58
|
+
# scope_overwrite_exception: false
|
59
|
+
|
60
|
+
# Skip the database version check, used when connecting to a db without
|
61
|
+
# admin access. (default: false)
|
62
|
+
# skip_version_check: false
|
63
|
+
|
64
|
+
# User Active Support's time zone in conversions. (default: true)
|
65
|
+
# use_activesupport_time_zone: true
|
66
|
+
|
67
|
+
# Ensure all times are UTC in the app side. (default: false)
|
68
|
+
# use_utc: false
|
69
|
+
test:
|
70
|
+
sessions:
|
71
|
+
default:
|
72
|
+
database: dummy_test
|
73
|
+
hosts:
|
74
|
+
- localhost:27017
|
75
|
+
options:
|
76
|
+
# In the test environment we lower the retries and retry interval to
|
77
|
+
# low amounts for fast failures.
|
78
|
+
max_retries: 1
|
79
|
+
retry_interval: 0
|