tb_checkout 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +162 -0
- data/Rakefile +24 -0
- data/app/assets/images/tb_checkout/admin/shopping_carts.png +0 -0
- data/app/assets/images/tb_checkout/admin/transactions.png +0 -0
- data/app/assets/javascripts/tb_checkout/admin/carts.js +2 -0
- data/app/assets/javascripts/tb_checkout/admin/transactions.js +2 -0
- data/app/assets/javascripts/tb_checkout/application.js +13 -0
- data/app/assets/javascripts/tb_checkout/cart_items.js +2 -0
- data/app/assets/javascripts/tb_checkout/carts.js +2 -0
- data/app/assets/javascripts/tb_checkout/transactions.js +2 -0
- data/app/assets/stylesheets/tb_checkout/admin/carts.css +4 -0
- data/app/assets/stylesheets/tb_checkout/admin/transactions.css +4 -0
- data/app/assets/stylesheets/tb_checkout/application.css +15 -0
- data/app/assets/stylesheets/tb_checkout/cart_items.css +4 -0
- data/app/assets/stylesheets/tb_checkout/carts.css +4 -0
- data/app/assets/stylesheets/tb_checkout/transactions.css +4 -0
- data/app/controllers/concerns/tb_checkout/controller_helpers.rb +16 -0
- data/app/controllers/tb_checkout/admin/carts_controller.rb +39 -0
- data/app/controllers/tb_checkout/admin/transactions_controller.rb +26 -0
- data/app/controllers/tb_checkout/application_controller.rb +6 -0
- data/app/controllers/tb_checkout/cart_items_controller.rb +63 -0
- data/app/controllers/tb_checkout/carts_controller.rb +8 -0
- data/app/controllers/tb_checkout/transactions_controller.rb +87 -0
- data/app/helpers/tb_checkout/admin/carts_helper.rb +13 -0
- data/app/helpers/tb_checkout/admin/transactions_helper.rb +16 -0
- data/app/helpers/tb_checkout/application_helper.rb +138 -0
- data/app/helpers/tb_checkout/transactions_helper.rb +2 -0
- data/app/models/concerns/tb_checkout/belongs_to_user_session.rb +15 -0
- data/app/models/concerns/tb_checkout/purchasable.rb +81 -0
- data/app/models/tb_checkout/basic_product.rb +6 -0
- data/app/models/tb_checkout/cart.rb +56 -0
- data/app/models/tb_checkout/cart_item.rb +48 -0
- data/app/models/tb_checkout/transaction.rb +253 -0
- data/app/views/tb_checkout/admin/carts/index.html.erb +54 -0
- data/app/views/tb_checkout/admin/carts/show.html.erb +45 -0
- data/app/views/tb_checkout/admin/transactions/_table.html.erb +24 -0
- data/app/views/tb_checkout/admin/transactions/index.html.erb +7 -0
- data/app/views/tb_checkout/admin/transactions/show.html.erb +70 -0
- data/app/views/tb_checkout/cart_items/create.html.erb +2 -0
- data/app/views/tb_checkout/cart_items/destroy.html.erb +2 -0
- data/app/views/tb_checkout/cart_items/update.html.erb +2 -0
- data/app/views/tb_checkout/carts/_cart.html.erb +65 -0
- data/app/views/tb_checkout/carts/show.html.erb +10 -0
- data/app/views/tb_checkout/transactions/_details.html.erb +17 -0
- data/app/views/tb_checkout/transactions/confirm.html.erb +11 -0
- data/app/views/tb_checkout/transactions/index.html.erb +29 -0
- data/app/views/tb_checkout/transactions/new.html.erb +90 -0
- data/app/views/tb_checkout/transactions/show.html.erb +14 -0
- data/config/locales/en.yml +23 -0
- data/config/routes.rb +20 -0
- data/db/migrate/20140703185256_create_tb_checkout_carts.rb +12 -0
- data/db/migrate/20140703185258_create_tb_checkout_cart_items.rb +15 -0
- data/db/migrate/20140703185259_create_tb_checkout_transactions.rb +23 -0
- data/db/migrate/20140707142350_create_tb_checkout_basic_products.rb +8 -0
- data/db/migrate/20140915202848_add_spud_user_and_session_id_to_transactions.rb +10 -0
- data/lib/tasks/tb_checkout_tasks.rake +19 -0
- data/lib/tb_checkout.rb +4 -0
- data/lib/tb_checkout/configuration.rb +8 -0
- data/lib/tb_checkout/engine.rb +36 -0
- data/lib/tb_checkout/schema.rb +51 -0
- data/lib/tb_checkout/version.rb +3 -0
- data/spec/controllers/tb_checkout/carts_controller_spec.rb +11 -0
- data/spec/controllers/tb_checkout/transactions_controller_spec.rb +110 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +30 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +13 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +82 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.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/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/migrate/20140915202259_create_spud_admin_permissions.tb_core.rb +12 -0
- data/spec/dummy/db/migrate/20140915202260_create_spud_users.tb_core.rb +30 -0
- data/spec/dummy/db/migrate/20140915202261_add_time_zone_to_spud_user.tb_core.rb +7 -0
- data/spec/dummy/db/migrate/20140915202262_add_scope_to_spud_admin_permissions.tb_core.rb +7 -0
- data/spec/dummy/db/migrate/20140915202263_create_spud_user_settings.tb_core.rb +12 -0
- data/spec/dummy/db/migrate/20140915202264_create_spud_roles.tb_core.rb +11 -0
- data/spec/dummy/db/migrate/20140915202265_create_spud_permissions.tb_core.rb +11 -0
- data/spec/dummy/db/migrate/20140915202266_create_spud_role_permissions.tb_core.rb +12 -0
- data/spec/dummy/db/migrate/20140915202267_drop_spud_admin_permissions.tb_core.rb +16 -0
- data/spec/dummy/db/migrate/20140915202268_create_tb_checkout_carts.tb_checkout_engine.rb +13 -0
- data/spec/dummy/db/migrate/20140915202269_create_tb_checkout_cart_items.tb_checkout_engine.rb +16 -0
- data/spec/dummy/db/migrate/20140915202270_create_tb_checkout_transactions.tb_checkout_engine.rb +24 -0
- data/spec/dummy/db/migrate/20140915202271_create_tb_checkout_basic_products.tb_checkout_engine.rb +9 -0
- data/spec/dummy/db/migrate/20140915234534_add_spud_user_and_session_id_to_transactions.tb_checkout_engine.rb +11 -0
- data/spec/dummy/db/schema.rb +135 -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/favicon.ico +0 -0
- data/spec/factories/spud_users.rb +16 -0
- data/spec/factories/tb_checkout_basic_products.rb +8 -0
- data/spec/factories/tb_checkout_cart_items.rb +11 -0
- data/spec/factories/tb_checkout_carts.rb +14 -0
- data/spec/factories/tb_checkout_transactions.rb +37 -0
- data/spec/models/tb_checkout/transaction_spec.rb +5 -0
- data/spec/rails_helper.rb +73 -0
- data/spec/spec_helper.rb +85 -0
- metadata +335 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'active_support/deprecation'
|
2
|
+
|
3
|
+
module TbCheckout
|
4
|
+
module Schema
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
ActiveRecord::ConnectionAdapters::Table.send :include, TableDefinition
|
8
|
+
ActiveRecord::ConnectionAdapters::TableDefinition.send :include, TableDefinition
|
9
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.send :include, Statements
|
10
|
+
ActiveRecord::Migration::CommandRecorder.send :include, CommandRecorder
|
11
|
+
end
|
12
|
+
|
13
|
+
module Statements
|
14
|
+
# Add purchasable columns to the given database table
|
15
|
+
#
|
16
|
+
def add_tb_checkout_purchasable(table_name)
|
17
|
+
add_column(table_name, :description, :string)
|
18
|
+
add_column(table_name, :price, :decimal, :precision => 8, :scale => 2)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Remove purchasable columns from the given database table
|
22
|
+
#
|
23
|
+
def remove_tb_checkout_purchasable(table_name)
|
24
|
+
remove_column(table_name, :description)
|
25
|
+
remove_column(table_name, :price)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
module TableDefinition
|
30
|
+
# Add purchasable columns to the given database table
|
31
|
+
#
|
32
|
+
def tb_checkout_purchasable
|
33
|
+
column(:description, :string)
|
34
|
+
column(:price, :decimal, :precision => 8, :scale => 2)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
module CommandRecorder #:nodoc:
|
39
|
+
def add_tb_checkout_purchasable(*args)
|
40
|
+
record(:add_tb_checkout_purchasable, args)
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def invert_add_tb_checkout_purchasable(args)
|
46
|
+
[:remove_tb_checkout_purchasable, args]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe TbCheckout::TransactionsController, :type => :controller do
|
4
|
+
let(:user) { FactoryGirl.create(:spud_user) }
|
5
|
+
let(:cart) { FactoryGirl.create(:tb_checkout_cart, :spud_user => user) }
|
6
|
+
|
7
|
+
setup :activate_authlogic
|
8
|
+
|
9
|
+
describe "While logged out" do
|
10
|
+
it "should list transactions for the current session" do
|
11
|
+
iterations = 3
|
12
|
+
iterations.times do |i|
|
13
|
+
cart = FactoryGirl.create(:tb_checkout_cart, :session_id => session.id)
|
14
|
+
transaction = FactoryGirl.create(:tb_checkout_transaction, :captured, :cart => cart)
|
15
|
+
end
|
16
|
+
get :index
|
17
|
+
expect(response).to be_success
|
18
|
+
expect(assigns(:transactions).count).to eq(iterations)
|
19
|
+
expect(assigns(:transactions).first.session_id).to eq(session.id)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "While logged in" do
|
24
|
+
before(:each) do
|
25
|
+
SpudUserSession.create(user)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should list transactions for the current user" do
|
29
|
+
iterations = 3
|
30
|
+
iterations.times do |i|
|
31
|
+
transaction = FactoryGirl.create(:tb_checkout_transaction, :captured, :cart => cart)
|
32
|
+
end
|
33
|
+
get :index
|
34
|
+
expect(response).to be_success
|
35
|
+
expect(assigns(:transactions).count).to eq(iterations)
|
36
|
+
expect(assigns(:transactions).first.spud_user).to eq(user)
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "with an empty cart" do
|
40
|
+
it "should redirect back to the shopping cart" do
|
41
|
+
get :new
|
42
|
+
expect(response).to redirect_to(tb_checkout_cart_path)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "with an item in the cart" do
|
47
|
+
before(:each) do
|
48
|
+
controller.tb_checkout_current_cart.add_to_cart(FactoryGirl.create(:tb_checkout_basic_product))
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should show the checkout form" do
|
52
|
+
get :new
|
53
|
+
expect(response).to be_success
|
54
|
+
expect(assigns(@transaction)).to_not be(nil)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should re-render the form if the transaction is invalid" do
|
58
|
+
attributes = FactoryGirl.attributes_for(:tb_checkout_transaction, :with_invalid_card)
|
59
|
+
post :create, :tb_checkout_transaction => attributes
|
60
|
+
expect(subject).to render_template(:new)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should re-render the form if the payment gateway returns an exception" do
|
64
|
+
attributes = FactoryGirl.attributes_for(:tb_checkout_transaction, :with_exception_card)
|
65
|
+
post :create, :tb_checkout_transaction => attributes
|
66
|
+
transaction = TbCheckout::Transaction.last
|
67
|
+
expect(transaction.status).to eq(TbCheckout::Transaction::Status::FAIL)
|
68
|
+
expect(subject).to render_template(:new)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should redirect if the transaction is valid" do
|
72
|
+
post :create, :tb_checkout_transaction => FactoryGirl.attributes_for(:tb_checkout_transaction)
|
73
|
+
transaction = TbCheckout::Transaction.last
|
74
|
+
expect(transaction).to_not eq(nil)
|
75
|
+
expect(response).to redirect_to(confirm_tb_checkout_transaction_path(transaction))
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should render the confirmation page" do
|
79
|
+
transaction = FactoryGirl.create(:tb_checkout_transaction, :authorized, :cart => controller.tb_checkout_current_cart)
|
80
|
+
get :confirm, :id => transaction.id
|
81
|
+
expect(response).to be_success
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should capture the transaction and redirect to the detail page" do
|
85
|
+
transaction = FactoryGirl.create(:tb_checkout_transaction, :authorized, :cart => controller.tb_checkout_current_cart)
|
86
|
+
patch :capture, :id => transaction.id
|
87
|
+
transaction.reload()
|
88
|
+
expect(transaction.status).to eq(TbCheckout::Transaction::Status::CAPTURED)
|
89
|
+
expect(response).to redirect_to(tb_checkout_transaction_path(transaction))
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should autofill the most recent billing info" do
|
94
|
+
controller.tb_checkout_current_cart.add_to_cart(FactoryGirl.create(:tb_checkout_basic_product))
|
95
|
+
transaction = FactoryGirl.create(:tb_checkout_transaction, :captured, :cart => controller.tb_checkout_current_cart, :spud_user => user)
|
96
|
+
|
97
|
+
controller.tb_checkout_current_cart.add_to_cart(FactoryGirl.create(:tb_checkout_basic_product))
|
98
|
+
get :new
|
99
|
+
expect(assigns(:transaction).billing_first_name).to eq(transaction.billing_first_name)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should show the transaction detail" do
|
103
|
+
transaction = FactoryGirl.create(:tb_checkout_transaction, :captured, :cart => cart, :spud_user => user)
|
104
|
+
get :show, :id => transaction.id
|
105
|
+
expect(response).to be_success
|
106
|
+
expect(assigns(:transaction)).to eq(transaction)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "tb_checkout"
|
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
|
+
|
22
|
+
ActiveMerchant::Billing::Base.mode = :test
|
23
|
+
|
24
|
+
TbCheckout.configure do |config|
|
25
|
+
config.gateway = ActiveMerchant::Billing::BogusGateway.new()
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,37 @@
|
|
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 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
|
+
|
30
|
+
# Adds additional error checking when serving assets at runtime.
|
31
|
+
# Checks for improperly declared sprockets dependencies.
|
32
|
+
# Raises helpful error messages.
|
33
|
+
config.assets.raise_runtime_errors = true
|
34
|
+
|
35
|
+
# Raises error for missing translations
|
36
|
+
# config.action_view.raise_on_missing_translations = true
|
37
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
Rails.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 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.
|
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
|
+
# `config.assets.precompile` has moved to config/initializers/assets.rb
|
36
|
+
|
37
|
+
# Specifies the header that your server uses for sending files.
|
38
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
39
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
40
|
+
|
41
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
42
|
+
# config.force_ssl = true
|
43
|
+
|
44
|
+
# Set to :debug to see everything in the log.
|
45
|
+
config.log_level = :info
|
46
|
+
|
47
|
+
# Prepend all log lines with the following tags.
|
48
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
49
|
+
|
50
|
+
# Use a different logger for distributed setups.
|
51
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
52
|
+
|
53
|
+
# Use a different cache store in production.
|
54
|
+
# config.cache_store = :mem_cache_store
|
55
|
+
|
56
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
57
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
58
|
+
|
59
|
+
# Precompile additional assets.
|
60
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
61
|
+
# config.assets.precompile += %w( search.js )
|
62
|
+
|
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.
|
65
|
+
# config.action_mailer.raise_delivery_errors = false
|
66
|
+
|
67
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
68
|
+
# the I18n.default_locale when a translation cannot be found).
|
69
|
+
config.i18n.fallbacks = true
|
70
|
+
|
71
|
+
# Send deprecation notices to registered listeners.
|
72
|
+
config.active_support.deprecation = :notify
|
73
|
+
|
74
|
+
# Disable automatic flushing of the log to improve performance.
|
75
|
+
# config.autoflush_log = false
|
76
|
+
|
77
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
78
|
+
config.log_formatter = ::Logger::Formatter.new
|
79
|
+
|
80
|
+
# Do not dump schema after migrations.
|
81
|
+
config.active_record.dump_schema_after_migration = false
|
82
|
+
end
|