robot_catcher 0.0.1 → 0.0.3

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 (95) hide show
  1. checksums.yaml +15 -0
  2. data/README.md +116 -0
  3. data/Rakefile +9 -5
  4. data/lib/robot_catcher/helpers.rb +5 -15
  5. data/lib/robot_catcher/models.rb +9 -5
  6. data/lib/robot_catcher/version.rb +1 -1
  7. data/test/dummy/README.rdoc +248 -15
  8. data/test/dummy/Rakefile +2 -1
  9. data/test/dummy/app/assets/javascripts/application.js +6 -4
  10. data/test/dummy/app/assets/stylesheets/application.css +4 -6
  11. data/test/dummy/app/controllers/application_controller.rb +1 -3
  12. data/test/dummy/app/controllers/articles_controller.rb +46 -12
  13. data/test/dummy/app/models/article.rb +1 -0
  14. data/test/dummy/app/views/articles/_form.html.erb +6 -6
  15. data/test/dummy/app/views/layouts/application.html.erb +2 -2
  16. data/test/dummy/config/application.rb +35 -2
  17. data/test/dummy/config/boot.rb +9 -4
  18. data/test/dummy/config/database.yml +8 -8
  19. data/test/dummy/config/environment.rb +3 -3
  20. data/test/dummy/config/environments/development.rb +18 -22
  21. data/test/dummy/config/environments/production.rb +34 -46
  22. data/test/dummy/config/environments/test.rb +14 -19
  23. data/test/dummy/config/initializers/inflections.rb +5 -6
  24. data/test/dummy/config/initializers/mime_types.rb +1 -0
  25. data/test/dummy/config/initializers/secret_token.rb +7 -0
  26. data/test/dummy/config/initializers/session_store.rb +6 -1
  27. data/test/dummy/config/initializers/wrap_parameters.rb +6 -6
  28. data/test/dummy/config/locales/en.yml +2 -20
  29. data/test/dummy/config/routes.rb +26 -24
  30. data/test/dummy/config.ru +2 -2
  31. data/test/dummy/db/development.sqlite3 +0 -0
  32. data/test/dummy/db/migrate/{20151108205618_create_articles.rb → 0_create_articles.rb} +1 -1
  33. data/test/dummy/db/schema.rb +5 -5
  34. data/test/dummy/db/test.sqlite3 +0 -0
  35. data/test/dummy/log/development.log +1509 -2682
  36. data/test/dummy/log/localdev.log +1 -0
  37. data/test/dummy/public/404.html +13 -54
  38. data/test/dummy/public/422.html +13 -54
  39. data/test/dummy/public/500.html +12 -53
  40. data/test/dummy/script/rails +6 -0
  41. data/test/dummy/tmp/cache/assets/C5B/380/sprockets%2F44f4979327d799d2103258cce2e11554 +0 -0
  42. data/test/dummy/tmp/cache/assets/CA4/AC0/sprockets%2F0069c03442e13e5a34e633c34fbf1866 +0 -0
  43. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  44. data/test/dummy/tmp/cache/assets/CEE/3C0/sprockets%2F39dfc00887914e7b8e1c73859aed2540 +0 -0
  45. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  46. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  47. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  48. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  49. data/test/dummy/tmp/cache/assets/E01/2C0/sprockets%2Fb0070cf61ab50c99ce9ddbf2f293d9fe +0 -0
  50. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  51. data/test/dummy/tmp/pids/server.pid +1 -1
  52. data/test/test_helper.rb +3 -7
  53. metadata +63 -132
  54. data/test/dummy/app/assets/javascripts/articles.js +0 -2
  55. data/test/dummy/app/assets/stylesheets/articles.css +0 -4
  56. data/test/dummy/app/assets/stylesheets/scaffold.css +0 -56
  57. data/test/dummy/bin/bundle +0 -3
  58. data/test/dummy/bin/rails +0 -4
  59. data/test/dummy/bin/rake +0 -4
  60. data/test/dummy/bin/setup +0 -29
  61. data/test/dummy/config/initializers/assets.rb +0 -11
  62. data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
  63. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  64. data/test/dummy/config/secrets.yml +0 -22
  65. data/test/dummy/test/controllers/articles_controller_test.rb +0 -49
  66. data/test/dummy/test/fixtures/articles.yml +0 -9
  67. data/test/dummy/test/models/article_test.rb +0 -7
  68. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/--2G_c3lCtePsllqkgTSDvk0ws9adbGDQcRvLN_EQ88.cache +0 -1
  69. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/-OJUBxdS-bG4zgi-HNiw9Xlp2QIvHoW8uLDPD75uXpI.cache +0 -2
  70. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +0 -2
  71. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/6uLqoeIeLD2NhPQtj3DYvLFYpEraf1qU147qnysVO6g.cache +0 -1
  72. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/9DpUR_fC14S52b3zrRiKeYjtEArvbqKqmYmCMGHiD9k.cache +0 -0
  73. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/DmmfrCpXtt74Hr6NO54lxyOCDv6klnDyBqeDFR7oDU8.cache +0 -2
  74. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/ELhioJOkik-XcPi3xdXhtHPxP_N8Z1sOLprd6_6TgLY.cache +0 -0
  75. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/JOBnsEqvVtSYuP7X3CVBY5Dxm8D_TINDaEumd2pwmkE.cache +0 -1
  76. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +0 -2
  77. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/UV1QownSHK65LSLEBMZmSb9Gi-dyrL7sk8uw0slVYEc.cache +0 -1
  78. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/VWPIp3E8NJGBTg9eyT0mbVqhCyhZ1UQzQhIde-3joig.cache +0 -0
  79. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/WQeBW4dfEsVuZ8eNRzY3TghX-GvNZYZy_VCJ42fqMM4.cache +0 -1
  80. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/_xcIdFV-At2pOKyIP31prJqJzCsmdsuoYlkC1DB2jDQ.cache +0 -2
  81. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/aS4gFox4Lh7GJYDZIrtGDgdpp56SlZYzEOdAVy6iSC0.cache +0 -1
  82. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/dphXxQV1ZyMzvKy0tXw9loofG0G8_4MC_ZXSE_eHnFI.cache +0 -2
  83. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/fkqQtAYuWFbb3cJ_DYZg-rtZpbHzWUyEut5YrxkEBOI.cache +0 -0
  84. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +0 -2
  85. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/mLUBzNlQGEI7HKRueSOU69pwu4qJb0dgVLB8yjE6Kr4.cache +0 -1
  86. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/mibJePh9DmzCatUn-6ukNUFR9SygbjuaunJ9JPtwMD0.cache +0 -0
  87. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +0 -2
  88. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/pyh8QRGkl9emfRSb4iUUwm_Bta21AwFIzZKueTu30W4.cache +0 -0
  89. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/qvll1qPabMn6TTkpuGOnx99Zg9gsM7t8pp2T63wFYKg.cache +0 -0
  90. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/rNpn7wAAWvFg9ecDT_imL7EYAYHTO17CUnJLmprWzdg.cache +0 -1
  91. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/v5edzu0SjVPbdCoXthlLmNhOVlForWZxZFcuObvVPzk.cache +0 -1
  92. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/wG_whueNWUbRh4wvgMhX2f7EtoDSqX1y_OwF9RgjLvc.cache +0 -2
  93. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/woubQ3T_RRQDsMosM6-mmlJMMsxmT-w16njeEdHzjG4.cache +0 -1
  94. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/zLqPuG6vCF0XaKppCo40WXOlrM9beqArYTWlSUS9lp4.cache +0 -1
  95. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/zNDIuWl4KLiHQ06qzTYjxaWnLh0wa5ePZnqir-PW_KQ.cache +0 -1
@@ -1,58 +1,92 @@
1
1
  class ArticlesController < ApplicationController
2
- before_action :set_article, only: [:show, :edit, :update, :destroy]
3
-
4
2
  # GET /articles
3
+ # GET /articles.json
5
4
  def index
6
5
  @articles = Article.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @articles }
10
+ end
7
11
  end
8
12
 
9
13
  # GET /articles/1
14
+ # GET /articles/1.json
10
15
  def show
16
+ @article = Article.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @article }
21
+ end
11
22
  end
12
23
 
13
24
  # GET /articles/new
25
+ # GET /articles/new.json
14
26
  def new
15
27
  @article = Article.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.json { render json: @article }
32
+ end
16
33
  end
17
34
 
18
35
  # GET /articles/1/edit
19
36
  def edit
37
+ @article = Article.find(params[:id])
20
38
  end
21
39
 
22
40
  # POST /articles
41
+ # POST /articles.json
23
42
  def create
24
- @article = Article.new(article_params)
43
+ @article = Article.new(title: params[:title], text: params[:text])
25
44
 
26
45
  if @article.robot?(params, request.remote_ip)
27
46
  redirect_to @article, notice: 'Stupid robot.'
28
47
  return
29
48
  end
30
49
 
31
- if @article.save
32
- redirect_to @article, notice: 'Article was successfully created.'
33
- else
34
- render :new
50
+ respond_to do |format|
51
+ if @article.save
52
+ format.html { redirect_to @article, notice: 'Article was successfully created.' }
53
+ format.json { render json: @article, status: :created, location: @article }
54
+ else
55
+ format.html { render action: "new" }
56
+ format.json { render json: @article.errors, status: :unprocessable_entity }
57
+ end
35
58
  end
36
59
  end
37
60
 
38
61
  # PATCH/PUT /articles/1
39
62
  def update
63
+ @article = Article.find(params[:id])
64
+
40
65
  if @article.robot?(params, request.remote_ip)
41
66
  redirect_to @article, notice: 'Stupid robot.'
42
67
  return
43
68
  end
44
69
 
45
- if @article.update(arcticle_params)
46
- redirect_to @article, notice: 'Article was successfully updated.'
47
- else
48
- render :edit
70
+ respond_to do |format|
71
+ if @article.update_attributes(title: params[:title], text: params[:text])
72
+ format.html { redirect_to @article, notice: 'Article was successfully updated.' }
73
+ format.json { head :no_content }
74
+ else
75
+ format.html { render action: "edit" }
76
+ format.json { render json: @article.errors, status: :unprocessable_entity }
77
+ end
49
78
  end
50
79
  end
51
80
 
52
81
  # DELETE /articles/1
53
82
  def destroy
83
+ @article = Article.find(params[:id])
54
84
  @article.destroy
55
- redirect_to articles_url, notice: 'Article was successfully destroyed.'
85
+
86
+ respond_to do |format|
87
+ format.html { redirect_to articles_url }
88
+ format.json { head :no_content }
89
+ end
56
90
  end
57
91
 
58
92
  private
@@ -1,3 +1,4 @@
1
1
  class Article < ActiveRecord::Base
2
+ attr_accessible :title, :text
2
3
  robot_catch :title, :text
3
4
  end
@@ -1,4 +1,4 @@
1
- <%= rc_form_for(@article, ip: request.remote_ip) do |f| %>
1
+ <%= rc_form_tag('/articles', ip: request.remote_ip) do |f| %>
2
2
  <% if @article.errors.any? %>
3
3
  <div id="error_explanation">
4
4
  <h2><%= pluralize(@article.errors.count, "error") %> prohibited this article from being saved:</h2>
@@ -12,16 +12,16 @@
12
12
  <% end %>
13
13
 
14
14
  <div>
15
- <%= f.label 'title' %><br>
16
- <%= f.text_field 'title' %>
15
+ <%= label_tag 'title' %><br>
16
+ <%= rc_text_field_tag 'title' %>
17
17
  </div>
18
18
 
19
19
  <div>
20
- <%= f.label 'text' %><br>
21
- <%= f.text_area 'text' %>
20
+ <%= label_tag 'text' %><br>
21
+ <%= rc_text_area_tag 'text' %>
22
22
  </div>
23
23
 
24
24
  <div>
25
- <%= f.submit %>
25
+ <%= submit_tag %>
26
26
  </div>
27
27
  <% end %>
@@ -2,8 +2,8 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Dummy</title>
5
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= javascript_include_tag "application" %>
7
7
  <%= csrf_meta_tags %>
8
8
  </head>
9
9
  <body>
@@ -11,6 +11,16 @@ module Dummy
11
11
  # Application configuration should go into files in config/initializers
12
12
  # -- all .rb files in that directory are automatically loaded.
13
13
 
14
+ # Custom directories with classes and modules you want to be autoloadable.
15
+ # config.autoload_paths += %W(#{config.root}/extras)
16
+
17
+ # Only load the plugins named here, in the order given (default is alphabetical).
18
+ # :all can be used as a placeholder for all plugins not explicitly named.
19
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
20
+
21
+ # Activate observers that should always be running.
22
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
23
+
14
24
  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15
25
  # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16
26
  # config.time_zone = 'Central Time (US & Canada)'
@@ -19,8 +29,31 @@ module Dummy
19
29
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
30
  # config.i18n.default_locale = :de
21
31
 
22
- # Do not swallow errors in after_commit/after_rollback callbacks.
23
- config.active_record.raise_in_transactional_callbacks = true
32
+ # Configure the default encoding used in templates for Ruby 1.9.
33
+ config.encoding = "utf-8"
34
+
35
+ # Configure sensitive parameters which will be filtered from the log file.
36
+ config.filter_parameters += [:password]
37
+
38
+ # Enable escaping HTML in JSON.
39
+ config.active_support.escape_html_entities_in_json = true
40
+
41
+ # Use SQL instead of Active Record's schema dumper when creating the database.
42
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
43
+ # like if you have constraints or database-specific column types
44
+ # config.active_record.schema_format = :sql
45
+
46
+ # Enforce whitelist mode for mass assignment.
47
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
48
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
49
+ # parameters by using an attr_accessible or attr_protected declaration.
50
+ config.active_record.whitelist_attributes = true
51
+
52
+ # Enable the asset pipeline
53
+ config.assets.enabled = true
54
+
55
+ # Version of your assets, change this if you want to expire all your assets
56
+ config.assets.version = '1.0'
24
57
  end
25
58
  end
26
59
 
@@ -1,5 +1,10 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
3
 
4
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -3,23 +3,23 @@
3
3
  #
4
4
  # Ensure the SQLite 3 gem is defined in your Gemfile
5
5
  # gem 'sqlite3'
6
- #
7
- default: &default
6
+ development:
8
7
  adapter: sqlite3
8
+ database: db/development.sqlite3
9
9
  pool: 5
10
10
  timeout: 5000
11
11
 
12
- development:
13
- <<: *default
14
- database: db/development.sqlite3
15
-
16
12
  # Warning: The database defined as "test" will be erased and
17
13
  # re-generated from your development database when you run "rake".
18
14
  # Do not set this db to the same as development or production.
19
15
  test:
20
- <<: *default
16
+ adapter: sqlite3
21
17
  database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
22
20
 
23
21
  production:
24
- <<: *default
22
+ adapter: sqlite3
25
23
  database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -1,5 +1,5 @@
1
- # Load the Rails application.
1
+ # Load the rails application
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
- # Initialize the Rails application.
5
- Rails.application.initialize!
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -1,41 +1,37 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
3
 
4
4
  # In the development environment your application's code is reloaded on
5
5
  # every request. This slows down response time but is perfect for development
6
6
  # since you don't have to restart the web server when you make code changes.
7
7
  config.cache_classes = false
8
8
 
9
- # Do not eager load code on boot.
10
- config.eager_load = false
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
11
 
12
- # Show full error reports and disable caching.
12
+ # Show full error reports and disable caching
13
13
  config.consider_all_requests_local = true
14
14
  config.action_controller.perform_caching = false
15
15
 
16
- # Don't care if the mailer can't send.
16
+ # Don't care if the mailer can't send
17
17
  config.action_mailer.raise_delivery_errors = false
18
18
 
19
- # Print deprecation notices to the Rails logger.
19
+ # Print deprecation notices to the Rails logger
20
20
  config.active_support.deprecation = :log
21
21
 
22
- # Raise an error on page load if there are pending migrations.
23
- config.active_record.migration_error = :page_load
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
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
25
+ # Raise exception on mass assignment protection for Active Record models
26
+ config.active_record.mass_assignment_sanitizer = :strict
29
27
 
30
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31
- # yet still be able to expire them through the digest params.
32
- config.assets.digest = true
28
+ # Log the query plan for queries taking more than this (works
29
+ # with SQLite, MySQL, and PostgreSQL)
30
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
33
31
 
34
- # Adds additional error checking when serving assets at runtime.
35
- # Checks for improperly declared sprockets dependencies.
36
- # Raises helpful error messages.
37
- config.assets.raise_runtime_errors = true
32
+ # Do not compress assets
33
+ config.assets.compress = false
38
34
 
39
- # Raises error for missing translations
40
- # config.action_view.raise_on_missing_translations = true
35
+ # Expands the lines which load the assets
36
+ config.assets.debug = true
41
37
  end
@@ -1,79 +1,67 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
3
 
4
- # Code is not reloaded between requests.
4
+ # Code is not reloaded between requests
5
5
  config.cache_classes = true
6
6
 
7
- # Eager load code on boot. This eager loads most of Rails and
8
- # your application in memory, allowing both threaded 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.
7
+ # Full error reports are disabled and caching is turned on
14
8
  config.consider_all_requests_local = false
15
9
  config.action_controller.perform_caching = true
16
10
 
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
20
- # NGINX, varnish or squid.
21
- # config.action_dispatch.rack_cache = true
22
-
23
- # Disable serving static files from the `/public` folder by default since
24
- # Apache or NGINX already handles this.
25
- config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
26
13
 
27
- # Compress JavaScripts and CSS.
28
- config.assets.js_compressor = :uglifier
29
- # config.assets.css_compressor = :sass
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
30
16
 
31
- # Do not fallback to assets pipeline if a precompiled asset is missed.
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
32
18
  config.assets.compile = false
33
19
 
34
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
- # yet still be able to expire them through the digest params.
20
+ # Generate digests for assets URLs
36
21
  config.assets.digest = true
37
22
 
38
- # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
23
+ # Defaults to nil and saved in location specified by config.assets.prefix
24
+ # config.assets.manifest = YOUR_PATH
39
25
 
40
- # Specifies the header that your server uses for sending files.
41
- # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
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
43
29
 
44
30
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
45
31
  # config.force_ssl = true
46
32
 
47
- # Use the lowest log level to ensure availability of diagnostic information
48
- # when problems arise.
49
- config.log_level = :debug
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
50
35
 
51
- # Prepend all log lines with the following tags.
36
+ # Prepend all log lines with the following tags
52
37
  # config.log_tags = [ :subdomain, :uuid ]
53
38
 
54
- # Use a different logger for distributed setups.
39
+ # Use a different logger for distributed setups
55
40
  # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
56
41
 
57
- # Use a different cache store in production.
42
+ # Use a different cache store in production
58
43
  # config.cache_store = :mem_cache_store
59
44
 
60
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61
- # config.action_controller.asset_host = 'http://assets.example.com'
45
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
+ # config.action_controller.asset_host = "http://assets.example.com"
47
+
48
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
+ # config.assets.precompile += %w( search.js )
62
50
 
63
- # Ignore bad email addresses and do not raise email delivery errors.
64
- # Set this to true and configure the email server for immediate delivery to raise delivery errors.
51
+ # Disable delivery errors, bad email addresses will be ignored
65
52
  # config.action_mailer.raise_delivery_errors = false
66
53
 
54
+ # Enable threaded mode
55
+ # config.threadsafe!
56
+
67
57
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68
- # the I18n.default_locale when a translation cannot be found).
58
+ # the I18n.default_locale when a translation can not be found)
69
59
  config.i18n.fallbacks = true
70
60
 
71
- # Send deprecation notices to registered listeners.
61
+ # Send deprecation notices to registered listeners
72
62
  config.active_support.deprecation = :notify
73
63
 
74
- # Use default logging formatter so that PID and timestamp are not suppressed.
75
- config.log_formatter = ::Logger::Formatter.new
76
-
77
- # Do not dump schema after migrations.
78
- config.active_record.dump_schema_after_migration = false
64
+ # Log the query plan for queries taking more than this (works
65
+ # with SQLite, MySQL, and PostgreSQL)
66
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
79
67
  end
@@ -1,5 +1,5 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
3
 
4
4
  # The test environment is used exclusively to run your application's
5
5
  # test suite. You never need to work with it otherwise. Remember that
@@ -7,36 +7,31 @@ Rails.application.configure do
7
7
  # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
9
 
10
- # Do not eager load code on boot. This avoids loading your whole application
11
- # just for the purpose of running a single test. If you are using a tool that
12
- # preloads Rails for running tests, you may have to set it to true.
13
- config.eager_load = false
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"
14
13
 
15
- # Configure static file server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
17
- config.static_cache_control = 'public, max-age=3600'
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
18
16
 
19
- # Show full error reports and disable caching.
17
+ # Show full error reports and disable caching
20
18
  config.consider_all_requests_local = true
21
19
  config.action_controller.perform_caching = false
22
20
 
23
- # Raise exceptions instead of rendering exception templates.
21
+ # Raise exceptions instead of rendering exception templates
24
22
  config.action_dispatch.show_exceptions = false
25
23
 
26
- # Disable request forgery protection in test environment.
27
- config.action_controller.allow_forgery_protection = false
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
28
26
 
29
27
  # Tell Action Mailer not to deliver emails to the real world.
30
28
  # The :test delivery method accumulates sent emails in the
31
29
  # ActionMailer::Base.deliveries array.
32
30
  config.action_mailer.delivery_method = :test
33
31
 
34
- # Randomize the order test cases are executed.
35
- config.active_support.test_order = :random
32
+ # Raise exception on mass assignment protection for Active Record models
33
+ config.active_record.mass_assignment_sanitizer = :strict
36
34
 
37
- # Print deprecation notices to the stderr.
35
+ # Print deprecation notices to the stderr
38
36
  config.active_support.deprecation = :stderr
39
-
40
- # Raises error for missing translations
41
- # config.action_view.raise_on_missing_translations = true
42
37
  end
@@ -1,16 +1,15 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- # Add new inflection rules using the following format. Inflections
4
- # are locale specific, and you may define rules for as many different
5
- # locales as you wish. All of these examples are active by default:
6
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
7
6
  # inflect.plural /^(ox)$/i, '\1en'
8
7
  # inflect.singular /^(ox)en/i, '\1'
9
8
  # inflect.irregular 'person', 'people'
10
9
  # inflect.uncountable %w( fish sheep )
11
10
  # end
12
-
11
+ #
13
12
  # These inflection rules are supported but not enabled by default:
14
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
13
+ # ActiveSupport::Inflector.inflections do |inflect|
15
14
  # inflect.acronym 'RESTful'
16
15
  # end
@@ -2,3 +2,4 @@
2
2
 
3
3
  # Add new mime types for use in respond_to blocks:
4
4
  # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
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_token = '80a4f5d19a3adb0b1dbfba5a374cf8825a9c4fa530dfd10deabbb4dd5923bfeab6edfe3a4b7c289ad2024777a34f6899de4132b7217d7265c5893583c82a9b45'
@@ -1,3 +1,8 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Rails.application.config.session_store :cookie_store, key: '_dummy_session'
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 +1,14 @@
1
1
  # Be sure to restart your server when you modify this file.
2
-
2
+ #
3
3
  # This file contains settings for ActionController::ParamsWrapper which
4
4
  # is enabled by default.
5
5
 
6
6
  # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
7
  ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
8
+ wrap_parameters format: [:json]
9
9
  end
10
10
 
11
- # To enable root element in JSON for ActiveRecord objects.
12
- # ActiveSupport.on_load(:active_record) do
13
- # self.include_root_in_json = true
14
- # end
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -1,23 +1,5 @@
1
- # Files in the config/locales directory are used for internationalization
2
- # and are automatically loaded by Rails. If you want to use locales other
3
- # than English, add the necessary files in this directory.
4
- #
5
- # To use the locales, use `I18n.t`:
6
- #
7
- # I18n.t 'hello'
8
- #
9
- # In views, this is aliased to just `t`:
10
- #
11
- # <%= t('hello') %>
12
- #
13
- # To use a different locale, set it with `I18n.locale`:
14
- #
15
- # I18n.locale = :es
16
- #
17
- # This would use the information in config/locales/es.yml.
18
- #
19
- # To learn more, please read the Rails Internationalization guide
20
- # available at http://guides.rubyonrails.org/i18n.html.
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
21
3
 
22
4
  en:
23
5
  hello: "Hello world"