reporta-modules 0.0.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.
Files changed (81) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +203 -0
  4. data/Rakefile +20 -0
  5. data/lib/generators/reporta/views_generator.rb +24 -0
  6. data/lib/generators/templates/reports/_box.html.erb +48 -0
  7. data/lib/generators/templates/reports/_chartjs_bar.html.erb +31 -0
  8. data/lib/generators/templates/reports/_chartjs_line.html.erb +33 -0
  9. data/lib/generators/templates/reports/_chartjs_pie.html.erb +19 -0
  10. data/lib/generators/templates/reports/_filters.html.erb +100 -0
  11. data/lib/generators/templates/reports/_table.html.erb +49 -0
  12. data/lib/reporta-modules.rb +15 -0
  13. data/lib/reporta/box_helper.rb +17 -0
  14. data/lib/reporta/chartjs_helper.rb +74 -0
  15. data/lib/reporta/models/column.rb +68 -0
  16. data/lib/reporta/models/filter.rb +42 -0
  17. data/lib/reporta/models/form.rb +77 -0
  18. data/lib/reporta/models/reportable.rb +50 -0
  19. data/lib/reporta/railtie.rb +8 -0
  20. data/lib/reporta/version.rb +3 -0
  21. data/lib/reporta/view_helper.rb +38 -0
  22. data/lib/tasks/reporta_tasks.rake +4 -0
  23. data/spec/dummy/README.rdoc +28 -0
  24. data/spec/dummy/Rakefile +6 -0
  25. data/spec/dummy/app/assets/javascripts/application.js +18 -0
  26. data/spec/dummy/app/assets/javascripts/jquery.dataTables.js +12099 -0
  27. data/spec/dummy/app/assets/javascripts/jquery.flot.js +3061 -0
  28. data/spec/dummy/app/assets/javascripts/jquery.flot.time.js +431 -0
  29. data/spec/dummy/app/assets/javascripts/jquery.js +2 -0
  30. data/spec/dummy/app/assets/stylesheets/application.css +14 -0
  31. data/spec/dummy/app/assets/stylesheets/bootstrap.min.css +9 -0
  32. data/spec/dummy/app/assets/stylesheets/style.css +57 -0
  33. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  34. data/spec/dummy/app/controllers/reports_controller.rb +18 -0
  35. data/spec/dummy/app/helpers/application_helper.rb +5 -0
  36. data/spec/dummy/app/models/account.rb +3 -0
  37. data/spec/dummy/app/models/account_chart.rb +41 -0
  38. data/spec/dummy/app/models/account_report.rb +39 -0
  39. data/spec/dummy/app/models/user.rb +8 -0
  40. data/spec/dummy/app/views/layouts/application.html.erb +28 -0
  41. data/spec/dummy/app/views/reports/chart.html.erb +6 -0
  42. data/spec/dummy/app/views/reports/dynamic_table.html.erb +33 -0
  43. data/spec/dummy/app/views/reports/dynamic_table_with_bootstrap.html.erb +37 -0
  44. data/spec/dummy/app/views/reports/overview.html.erb +4 -0
  45. data/spec/dummy/app/views/reports/table.html.erb +12 -0
  46. data/spec/dummy/bin/bundle +3 -0
  47. data/spec/dummy/bin/rails +4 -0
  48. data/spec/dummy/bin/rake +4 -0
  49. data/spec/dummy/config.ru +4 -0
  50. data/spec/dummy/config/application.rb +23 -0
  51. data/spec/dummy/config/boot.rb +5 -0
  52. data/spec/dummy/config/database.yml +25 -0
  53. data/spec/dummy/config/environment.rb +5 -0
  54. data/spec/dummy/config/environments/development.rb +29 -0
  55. data/spec/dummy/config/environments/production.rb +80 -0
  56. data/spec/dummy/config/environments/test.rb +36 -0
  57. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  58. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  59. data/spec/dummy/config/initializers/inflections.rb +16 -0
  60. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  61. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  62. data/spec/dummy/config/initializers/session_store.rb +3 -0
  63. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  64. data/spec/dummy/config/locales/en.yml +23 -0
  65. data/spec/dummy/config/routes.rb +7 -0
  66. data/spec/dummy/db/migrate/20130622041213_create_users.rb +14 -0
  67. data/spec/dummy/db/migrate/20130623054801_create_accounts.rb +9 -0
  68. data/spec/dummy/db/schema.rb +33 -0
  69. data/spec/dummy/db/seeds.rb +20 -0
  70. data/spec/dummy/db/test.sqlite3 +0 -0
  71. data/spec/dummy/log/test.log +1190 -0
  72. data/spec/dummy/public/404.html +58 -0
  73. data/spec/dummy/public/422.html +58 -0
  74. data/spec/dummy/public/500.html +57 -0
  75. data/spec/dummy/public/favicon.ico +0 -0
  76. data/spec/models/column_spec.rb +76 -0
  77. data/spec/models/filter_spec.rb +63 -0
  78. data/spec/models/form_spec.rb +81 -0
  79. data/spec/models/report_spec.rb +51 -0
  80. data/spec/spec_helper.rb +43 -0
  81. metadata +247 -0
@@ -0,0 +1,57 @@
1
+ body { padding: 20px 0; }
2
+ .highlight { background: rgb(255, 255, 187); }
3
+ .chart {
4
+ width: 100%;
5
+ height: 300px;
6
+ }
7
+ .filters {
8
+ margin-bottom: 10px;
9
+ padding: 10px;
10
+ background: rgb(243, 243, 243);
11
+ -webkit-border-radius: 6px;
12
+ -moz-border-radius: 6px;
13
+ border-radius: 6px;
14
+ }
15
+
16
+ .no-bootstap select { width: auto; }
17
+
18
+ /* The .bs-docs-sidenav styles a lovingly stolen from the Bootstrap demo site. */
19
+ .bs-docs-sidenav {
20
+ width: 228px;
21
+ margin: 20px 0 0 0;;
22
+ padding: 0;
23
+ background-color: #fff;
24
+ -webkit-border-radius: 6px;
25
+ -moz-border-radius: 6px;
26
+ border-radius: 6px;
27
+ -webkit-box-shadow: 0 1px 4px rgba(0,0,0,.065);
28
+ -moz-box-shadow: 0 1px 4px rgba(0,0,0,.065);
29
+ box-shadow: 0 1px 4px rgba(0,0,0,.065);
30
+ }
31
+ .bs-docs-sidenav > li > a {
32
+ display: block;
33
+ width: 190px \9;
34
+ margin: 0 0 -1px;
35
+ padding: 8px 14px;
36
+ border: 1px solid #e5e5e5;
37
+ }
38
+ .bs-docs-sidenav > li:first-child > a {
39
+ -webkit-border-radius: 6px 6px 0 0;
40
+ -moz-border-radius: 6px 6px 0 0;
41
+ border-radius: 6px 6px 0 0;
42
+ }
43
+ .bs-docs-sidenav > li:last-child > a {
44
+ -webkit-border-radius: 0 0 6px 6px;
45
+ -moz-border-radius: 0 0 6px 6px;
46
+ border-radius: 0 0 6px 6px;
47
+ }
48
+ .bs-docs-sidenav > .active > a {
49
+ position: relative;
50
+ z-index: 2;
51
+ padding: 9px 15px;
52
+ border: 0;
53
+ text-shadow: 0 1px 0 rgba(0,0,0,.15);
54
+ -webkit-box-shadow: inset 1px 0 0 rgba(0,0,0,.1), inset -1px 0 0 rgba(0,0,0,.1);
55
+ -moz-box-shadow: inset 1px 0 0 rgba(0,0,0,.1), inset -1px 0 0 rgba(0,0,0,.1);
56
+ box-shadow: inset 1px 0 0 rgba(0,0,0,.1), inset -1px 0 0 rgba(0,0,0,.1);
57
+ }
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery with: :exception
3
+ end
@@ -0,0 +1,18 @@
1
+ class ReportsController < ApplicationController
2
+
3
+ def table
4
+ @report = AccountReport.new(params[:form])
5
+ end
6
+
7
+ def dynamic_table
8
+ @report = AccountReport.new(params[:form])
9
+ end
10
+
11
+ def dynamic_table_with_bootstrap
12
+ @report = AccountReport.new(params[:form])
13
+ end
14
+
15
+ def chart
16
+ @report = AccountChart.new(params[:form])
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ module ApplicationHelper
2
+ def mailto(record)
3
+ mail_to record
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ class Account < ActiveRecord::Base
2
+ has_many :users
3
+ end
@@ -0,0 +1,41 @@
1
+ class AccountChart
2
+ include Reporta::Report
3
+
4
+ filter :gender, collection: %w(Any Male Female), include_blank: false
5
+
6
+ x_axis :months, as: :date, format: "%Y-%m-%d"
7
+ y_axis :accounts, title: 'Total Accounts'
8
+
9
+ line_chart :sign_ups
10
+ column_chart :average_age, line_width: 20, align: :left
11
+
12
+ def months
13
+ @months ||= (1..12).map { |month| Date.new(Date.today.year, month) }
14
+ end
15
+
16
+ def sign_ups(month)
17
+ total = accounts_by_month[month.to_date].to_a.size
18
+ [month.to_time.to_i * 1000, total]
19
+ end
20
+
21
+ def average_age(month)
22
+ accounts = accounts_by_month[month.to_date]
23
+ average = accounts.sum(&:age) / accounts.size
24
+ [month.to_time.to_i * 1000, average]
25
+ end
26
+
27
+ private
28
+
29
+ def accounts_by_month
30
+ @accounts_by_month ||= begin
31
+ users = User.all
32
+ if gender.present? && gender != 'Any'
33
+ users = users.where(gender: gender)
34
+ end
35
+ users.group_by do |account|
36
+ account.created_at.beginning_of_month.to_date
37
+ end
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,39 @@
1
+ class AccountReport
2
+ include Reporta::Report
3
+
4
+ filter :first_name
5
+ filter :age
6
+ filter :gender, collection: %w(Any Male Female), include_blank: false
7
+ filter :active, as: :boolean
8
+
9
+ column :first_name, helper: :mailto
10
+ column :last_name
11
+ column :age, class_names: 'highlight'
12
+ column :gender
13
+ column :active, title: 'Enabled'
14
+ column :account, data_chain: 'account.name'
15
+ column :created
16
+
17
+ def rows
18
+ users = User.where(active: active)
19
+
20
+ # Filter by substring match on first_name
21
+ if first_name.present?
22
+ users = users.where("LOWER(users.first_name) LIKE '%#{first_name.downcase}%'")
23
+ end
24
+
25
+ # Filter by selecte age
26
+ users = users.where(age: age) if age.present?
27
+
28
+ # Filter by gender unless the 'Any' option is selected
29
+ if gender.present? && gender != 'Any'
30
+ users = users.where(gender: gender)
31
+ end
32
+
33
+ users
34
+ end
35
+
36
+ def created(user)
37
+ user.created_at.strftime("%b %d, %Y")
38
+ end
39
+ end
@@ -0,0 +1,8 @@
1
+ class User < ActiveRecord::Base
2
+ belongs_to :account
3
+ GENDER = %w/male female/
4
+
5
+ def to_s
6
+ first_name
7
+ end
8
+ end
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", media: "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= content_for :head %>
8
+ <%= csrf_meta_tags %>
9
+ </head>
10
+ <body>
11
+ <div class="container">
12
+ <div class="row">
13
+ <div class="span3">
14
+ <ul class="nav nav-list bs-docs-sidenav affix">
15
+ <li><%= link_to 'Overview', '/' %></li>
16
+ <li><%= link_to 'Basic Table', '/table' %></li>
17
+ <li><%= link_to 'Dynamic Table', '/dynamic_table' %></li>
18
+ <li><%= link_to 'Dynamic Table With Bootstrap', '/dynamic_table_with_bootstrap' %></li>
19
+ <li><%= link_to 'Basic Chart', '/chart' %></li>
20
+ </ul>
21
+ </div>
22
+ <div class="span9">
23
+ <%= yield %>
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </body>
28
+ </html>
@@ -0,0 +1,6 @@
1
+ <h2>Basic Chart</h2>
2
+
3
+ <div class="filters">
4
+ <%= filters_for(@report) %>
5
+ </div>
6
+ <%= chart_for(@report, class_name: 'table') %>
@@ -0,0 +1,33 @@
1
+ <h2>Dynamic Table</h2>
2
+ <p>To create a table with client side pagination, inline filtering and other dynamic goodies you first need to include some Javascript files. The Reporta dynamic tables use <%= link_to 'DataTables', 'http://datatables.net/index' %> under the hood so anything you can do with DataTables you can do here as well.</p>
3
+ <p>If you don't already have it you will need a copy of <%= link_to 'jQuery', 'http://jquery.com/' %> and <%= link_to 'DataTables', 'http://datatables.net/download/' %> in your app/assets/javascripts directory</p>
4
+ <p>In your application.js file make sure you have the following lines in this order:</p>
5
+ <blockquote>#= require jquery<br/>
6
+ #= require jquery.dataTables<br/>
7
+ #= require reporta/dataTables
8
+ </blockquote>
9
+ <p>Now the dependencies are loaded we can display the report below like this:</p>
10
+ <blockquote><%%= filters_for(@report) %><br />
11
+ <%%= table_for(@report, class_name: 'table') %><br />
12
+ &lt;script type="text/javascript" charset="utf-8"&gt;<br />
13
+ &#160;&#160;$(function() {<br />
14
+ &#160;&#160;&#160;&#160;new Reporta.DynamicTable('.table');<br />
15
+ &#160;&#160;});<br />
16
+ &lt;/script&gt;<br />
17
+ </blockquote>
18
+ <p>The only difference between this and the <%= link_to 'Basic Table', '/table' %> is we added the extra Javascript that is called after the page is loaded to make the table dynamic.</p>
19
+ <p><strong>Note:</strong> As we are using Bootstrap here on the demo page the styling below is not quite right. It should look more like a deafult DataTable on your page. If you are using Bootstrap checkout the <%= link_to 'Dynamic Table With Bootstrap', '/dynamic_table_with_bootstrap' %> page.</p>
20
+
21
+ <h3>Example</h3>
22
+ <div class="filters">
23
+ <%= filters_for(@report) %>
24
+ </div>
25
+ <div class="no-bootstap">
26
+ <%= table_for(@report, class_name: 'table') %>
27
+ </div>
28
+
29
+ <script type="text/javascript" charset="utf-8">
30
+ $(function() {
31
+ new Reporta.DynamicTable('.table');
32
+ });
33
+ </script>
@@ -0,0 +1,37 @@
1
+ <%= content_for :head do %>
2
+ <%= javascript_include_tag "reporta/dataTables.bootstrap" %>
3
+ <% end %>
4
+
5
+ <h2>Dynamic Table With Bootstrap</h2>
6
+ <p>To get the data table looking nice with Bootstrap there is a few things that need to happen. First we need to make sure the following in you application.js file (note the extra dataTables.bootstrap file)</p>
7
+ <blockquote>#= require jquery<br />
8
+ #= require jquery.dataTables<br />
9
+ #= require reporta/dataTables<br />
10
+ #= require reporta/dataTables.bootstrap<br />
11
+ </blockquote>
12
+ <p>Now you can display the report like this:</p>
13
+ <blockquote><%%= filters_for(@report) %><br />
14
+ <%%= table_for(@report, class_name: 'table') %><br />
15
+ &lt;script type="text/javascript" charset="utf-8"&gt;<br />
16
+ &#160;&#160;$(function() {<br />
17
+ &#160;&#160;&#160;&#160;new Reporta.DynamicTable('.table.dynamic', { bootstrap: true });<br />
18
+ &#160;&#160;});<br />
19
+ &lt;/script&gt;<br />
20
+ </blockquote>
21
+ <p>The only difference between this and the <%= link_to 'Dynamic Table', '/dynamic_table' %> example is the extra Javascript file and passing bootstrap: true to Reporta.DynamicTable.</p>
22
+ <h3>Example</h3>
23
+ <div class="filters">
24
+ <%= filters_for(@report) %>
25
+ </div>
26
+ <div class="no-bootstap">
27
+ <%= table_for(@report, class_name: 'table dynamic') %>
28
+ </div>
29
+
30
+ <script type="text/javascript" charset="utf-8">
31
+ $(function() {
32
+ new Reporta.DynamicTable('.table.dynamic', {
33
+ bootstrap: true
34
+ });
35
+ });
36
+ </script>
37
+
@@ -0,0 +1,4 @@
1
+ <h2>Installing</h2>
2
+ <blockquote>
3
+ gem 'reporta'
4
+ </blockquote>
@@ -0,0 +1,12 @@
1
+ <h2>Basic Table</h2>
2
+ <p>To output your report as a table you must define a method named <strong>rows</strong> and at least 1 <strong>column</strong> within you report class. This method should return an array (or other enumerable object) with each item representing a row in the table.</p>
3
+ <p>The filtering form and the table below are output using the following 2 helpers.</p>
4
+ <blockquote><%%= filters_for(@report) %><br />
5
+ <%%= table_for(@report, class_name: 'table') %>
6
+ </blockquote>
7
+ <p>The class_name option sets the class of the generated table, here we are setting it to "table" so Bootstrap will add some basic styling</p>
8
+ <h3>Example</h3>
9
+ <div class="filters">
10
+ <%= filters_for(@report) %>
11
+ </div>
12
+ <%= table_for(@report, class_name: 'table') %>
@@ -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,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,23 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ require "reporta-modules"
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
+ end
22
+ end
23
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -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,5 @@
1
+ # Load the rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application.
5
+ Dummy::Application.initialize!
@@ -0,0 +1,29 @@
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
+ # Do not eager load code on boot.
10
+ config.eager_load = false
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
+ # Raise an error on page load if there are pending migrations
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+ end
@@ -0,0 +1,80 @@
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
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_assets = false
24
+
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
28
+
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
37
+
38
+ # Specifies the header that your server uses for sending files.
39
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+ # config.force_ssl = true
44
+
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
47
+
48
+ # Prepend all log lines with the following tags.
49
+ # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+ # Use a different logger for distributed setups.
52
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
+ # config.action_controller.asset_host = "http://assets.example.com"
59
+
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+ # config.assets.precompile += %w( search.js )
63
+
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
+ # config.action_mailer.raise_delivery_errors = false
67
+
68
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+ # the I18n.default_locale when a translation can not be found).
70
+ config.i18n.fallbacks = true
71
+
72
+ # Send deprecation notices to registered listeners.
73
+ config.active_support.deprecation = :notify
74
+
75
+ # Disable automatic flushing of the log to improve performance.
76
+ # config.autoflush_log = false
77
+
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
80
+ end