active_reporter 0.6.1 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +9 -9
- data/lib/active_reporter/aggregator/array.rb +1 -1
- data/lib/active_reporter/aggregator/count.rb +2 -2
- data/lib/active_reporter/aggregator/count_if.rb +2 -2
- data/lib/active_reporter/aggregator/ratio.rb +1 -1
- data/lib/active_reporter/aggregator.rb +9 -9
- data/lib/active_reporter/calculator.rb +2 -2
- data/lib/active_reporter/dimension/base.rb +3 -3
- data/lib/active_reporter/dimension/bin/set.rb +3 -3
- data/lib/active_reporter/dimension/bin/table.rb +1 -1
- data/lib/active_reporter/dimension/bin.rb +23 -15
- data/lib/active_reporter/dimension/category.rb +1 -1
- data/lib/active_reporter/dimension/enum.rb +1 -1
- data/lib/active_reporter/dimension/number.rb +3 -3
- data/lib/active_reporter/dimension/time.rb +4 -4
- data/lib/active_reporter/dimension.rb +8 -8
- data/lib/active_reporter/evaluator.rb +2 -2
- data/lib/active_reporter/inflector.rb +1 -1
- data/lib/active_reporter/report/aggregation.rb +12 -12
- data/lib/active_reporter/report/definition.rb +6 -6
- data/lib/active_reporter/report/validation.rb +26 -15
- data/lib/active_reporter/report.rb +3 -3
- data/lib/active_reporter/serializer/base.rb +6 -6
- data/lib/active_reporter/serializer/csv.rb +2 -2
- data/lib/active_reporter/serializer/form_field.rb +5 -5
- data/lib/active_reporter/serializer/highcharts.rb +6 -6
- data/lib/active_reporter/serializer.rb +7 -7
- data/lib/active_reporter/tracker/base.rb +1 -1
- data/lib/active_reporter/tracker.rb +3 -3
- data/lib/active_reporter/version.rb +1 -1
- data/lib/active_reporter.rb +7 -3
- data/spec/acceptance/data_spec.rb +49 -49
- data/spec/active_reporter/aggregator_spec.rb +37 -37
- data/spec/active_reporter/dimension/base_spec.rb +29 -29
- data/spec/active_reporter/dimension/bin/set_spec.rb +29 -29
- data/spec/active_reporter/dimension/bin/table_spec.rb +7 -7
- data/spec/active_reporter/dimension/bin_spec.rb +12 -12
- data/spec/active_reporter/dimension/category_spec.rb +22 -22
- data/spec/active_reporter/dimension/enum_spec.rb +12 -12
- data/spec/active_reporter/dimension/number_spec.rb +11 -11
- data/spec/active_reporter/dimension/time_spec.rb +20 -20
- data/spec/active_reporter/report_spec.rb +162 -162
- data/spec/active_reporter/serializer/hash_table_spec.rb +13 -13
- data/spec/active_reporter/serializer/highcharts_spec.rb +30 -30
- data/spec/active_reporter/serializer/table_spec.rb +22 -22
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/models/post_report.rb +1 -1
- data/spec/dummy/app/views/layouts/application.html.erb +2 -2
- data/spec/dummy/app/views/site/report.html.erb +5 -5
- data/spec/dummy/bin/bundle +2 -2
- data/spec/dummy/bin/rails +3 -3
- data/spec/dummy/bin/rake +2 -2
- data/spec/dummy/bin/setup +2 -2
- data/spec/dummy/config/application.rb +4 -4
- data/spec/dummy/config/boot.rb +3 -3
- data/spec/dummy/config/database.yml +3 -3
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/config/environments/production.rb +4 -4
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/dummy/config/initializers/assets.rb +1 -1
- data/spec/dummy/config/initializers/inflections.rb +4 -4
- data/spec/dummy/config/initializers/session_store.rb +1 -1
- data/spec/dummy/config/locales/en.yml +2 -2
- data/spec/dummy/config/routes.rb +9 -9
- data/spec/dummy/config.ru +1 -1
- data/spec/dummy/log/test.log +54769 -77257
- data/spec/spec_helper.rb +13 -13
- metadata +64 -44
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe ActiveReporter::Serializer::HashTable do
|
4
4
|
let(:report_model) do
|
@@ -16,7 +16,7 @@ describe ActiveReporter::Serializer::HashTable do
|
|
16
16
|
report_model.new(
|
17
17
|
aggregators: [:post_count, :likes_count],
|
18
18
|
groupers: %i[title created_at],
|
19
|
-
dimensions: { created_at: { bin_width:
|
19
|
+
dimensions: { created_at: { bin_width: "1 day" } }
|
20
20
|
)
|
21
21
|
end
|
22
22
|
|
@@ -25,20 +25,20 @@ describe ActiveReporter::Serializer::HashTable do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
before do
|
28
|
-
create(:post, created_at:
|
29
|
-
create(:post, created_at:
|
30
|
-
create(:post, created_at:
|
31
|
-
create(:post, created_at:
|
28
|
+
create(:post, created_at: "2016-01-01", likes: 2, title: "A")
|
29
|
+
create(:post, created_at: "2016-01-01", likes: 2, title: "A")
|
30
|
+
create(:post, created_at: "2016-01-01", likes: 1, title: "B")
|
31
|
+
create(:post, created_at: "2016-01-02", likes: 1, title: "A")
|
32
32
|
end
|
33
33
|
|
34
|
-
describe
|
35
|
-
it
|
34
|
+
describe "#report" do
|
35
|
+
it "builds report" do
|
36
36
|
expect(hash_table.table).to eq [
|
37
|
-
{ title:
|
38
|
-
{ title:
|
39
|
-
{ title:
|
40
|
-
{ title:
|
41
|
-
{ title:
|
37
|
+
{ title: "Title", created_at: "Created at", post_count: "Post count", likes_count: "Likes count" },
|
38
|
+
{ title: "A", created_at: "2016-01-01 00:00:00 UTC", post_count: "2", likes_count: "4" },
|
39
|
+
{ title: "A", created_at: "2016-01-02 00:00:00 UTC", post_count: "1", likes_count: "1" },
|
40
|
+
{ title: "B", created_at: "2016-01-01 00:00:00 UTC", post_count: "1", likes_count: "1" },
|
41
|
+
{ title: "B", created_at: "2016-01-02 00:00:00 UTC", post_count: "0", likes_count: "0" }
|
42
42
|
]
|
43
43
|
end
|
44
44
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe ActiveReporter::Serializer::Highcharts do
|
4
4
|
let(:report_model) do
|
@@ -16,10 +16,10 @@ describe ActiveReporter::Serializer::Highcharts do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
before do
|
19
|
-
create(:post, created_at:
|
20
|
-
create(:post, created_at:
|
21
|
-
create(:post, created_at:
|
22
|
-
create(:post, created_at:
|
19
|
+
create(:post, created_at: "2016-01-01", likes: 2, title: "A")
|
20
|
+
create(:post, created_at: "2016-01-01", likes: 2, title: "A")
|
21
|
+
create(:post, created_at: "2016-01-01", likes: 1, title: "B")
|
22
|
+
create(:post, created_at: "2016-01-02", likes: 1, title: "A")
|
23
23
|
end
|
24
24
|
|
25
25
|
def y_values(series)
|
@@ -30,20 +30,20 @@ describe ActiveReporter::Serializer::Highcharts do
|
|
30
30
|
series[:data].map { |d| d[:filters] }
|
31
31
|
end
|
32
32
|
|
33
|
-
describe
|
34
|
-
context
|
33
|
+
describe "#series" do
|
34
|
+
context "with one grouper" do
|
35
35
|
let(:report) do
|
36
36
|
report_model.new(aggregators: :post_count, groupers: %i[title])
|
37
37
|
end
|
38
38
|
|
39
|
-
it
|
39
|
+
it "returns one series of the y values (with filters)" do
|
40
40
|
expect(chart.series.count).to eq 1
|
41
41
|
# expect(y_values(chart.series[0])).to eq [3, 1]
|
42
|
-
expect(filters(chart.series[0])).to eq [{ title:
|
42
|
+
expect(filters(chart.series[0])).to eq [{ title: "A" }, { title: "B" }]
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
context
|
46
|
+
context "with two groupers" do
|
47
47
|
let(:report) do
|
48
48
|
report_model.new(
|
49
49
|
aggregators: :post_count,
|
@@ -52,45 +52,45 @@ describe ActiveReporter::Serializer::Highcharts do
|
|
52
52
|
)
|
53
53
|
end
|
54
54
|
|
55
|
-
it
|
55
|
+
it "returns one series for each x_2 value" do
|
56
56
|
expect(chart.series.count).to eq 2
|
57
57
|
# expect(y_values(chart.series[0])).to eq [1, 1]
|
58
58
|
expect(filters(chart.series[0])).to eq [
|
59
|
-
{ title:
|
60
|
-
{ title:
|
59
|
+
{ title: "A", likes: { min: 1, max: 2 } },
|
60
|
+
{ title: "B", likes: { min: 1, max: 2 } }
|
61
61
|
]
|
62
62
|
# expect(y_values(chart.series[1])).to eq [2, 0]
|
63
63
|
expect(filters(chart.series[1])).to eq [
|
64
|
-
{ title:
|
65
|
-
{ title:
|
64
|
+
{ title: "A", likes: { min: 2, max: 3 } },
|
65
|
+
{ title: "B", likes: { min: 2, max: 3 } }
|
66
66
|
]
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
context
|
70
|
+
context "with three groupers" do
|
71
71
|
let(:report) do
|
72
72
|
report_model.new(
|
73
73
|
aggregators: :post_count,
|
74
74
|
groupers: %i[title likes created_at],
|
75
75
|
dimensions: {
|
76
76
|
likes: { bin_width: 1 },
|
77
|
-
created_at: { bin_width:
|
77
|
+
created_at: { bin_width: "1 day" }
|
78
78
|
}
|
79
79
|
)
|
80
80
|
end
|
81
81
|
|
82
|
-
it
|
82
|
+
it "returns stacks for each x_3 of groups for each x_2" do
|
83
83
|
expect(chart.series.count).to eq 4
|
84
84
|
|
85
|
-
expect(chart.series[0][:stack]).to eq
|
86
|
-
expect(chart.series[1][:stack]).to eq
|
87
|
-
expect(chart.series[2][:stack]).to eq
|
88
|
-
expect(chart.series[3][:stack]).to eq
|
85
|
+
expect(chart.series[0][:stack]).to eq "2016-01-01"
|
86
|
+
expect(chart.series[1][:stack]).to eq "2016-01-01"
|
87
|
+
expect(chart.series[2][:stack]).to eq "2016-01-02"
|
88
|
+
expect(chart.series[3][:stack]).to eq "2016-01-02"
|
89
89
|
|
90
|
-
expect(chart.series[0][:id]).to eq
|
91
|
-
expect(chart.series[1][:id]).to eq
|
92
|
-
expect(chart.series[2][:linkedTo]).to eq
|
93
|
-
expect(chart.series[3][:linkedTo]).to eq
|
90
|
+
expect(chart.series[0][:id]).to eq "[1.0, 2.0)"
|
91
|
+
expect(chart.series[1][:id]).to eq "[2.0, 3.0)"
|
92
|
+
expect(chart.series[2][:linkedTo]).to eq "[1.0, 2.0)"
|
93
|
+
expect(chart.series[3][:linkedTo]).to eq "[2.0, 3.0)"
|
94
94
|
|
95
95
|
colors = chart.series.map { |s| s[:color] }
|
96
96
|
expect(colors.all?(&:present?)).to be true
|
@@ -100,12 +100,12 @@ describe ActiveReporter::Serializer::Highcharts do
|
|
100
100
|
|
101
101
|
# expect(y_values(chart.series[0])).to eq [0, 1]
|
102
102
|
|
103
|
-
jan1 = Time.zone.parse(
|
104
|
-
jan2 = Time.zone.parse(
|
103
|
+
jan1 = Time.zone.parse("2016-01-01")
|
104
|
+
jan2 = Time.zone.parse("2016-01-02")
|
105
105
|
|
106
106
|
expect(filters(chart.series[0])).to eq [
|
107
|
-
{ title:
|
108
|
-
{ title:
|
107
|
+
{ title: "A", likes: { min: 1.0, max: 2.0 }, created_at: { min: jan1, max: jan2 } },
|
108
|
+
{ title: "B", likes: { min: 1.0, max: 2.0 }, created_at: { min: jan1, max: jan2 } }
|
109
109
|
]
|
110
110
|
end
|
111
111
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe ActiveReporter::Serializer::Table do
|
4
4
|
let(:report_model) do
|
@@ -16,7 +16,7 @@ describe ActiveReporter::Serializer::Table do
|
|
16
16
|
aggregators: :post_count,
|
17
17
|
groupers: %i[created_at likes title],
|
18
18
|
dimensions: {
|
19
|
-
created_at: { bin_width:
|
19
|
+
created_at: { bin_width: "1 day" },
|
20
20
|
likes: { bin_width: 1 }
|
21
21
|
}
|
22
22
|
)
|
@@ -27,35 +27,35 @@ describe ActiveReporter::Serializer::Table do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
before do
|
30
|
-
create(:post, created_at:
|
31
|
-
create(:post, created_at:
|
32
|
-
create(:post, created_at:
|
33
|
-
create(:post, created_at:
|
30
|
+
create(:post, created_at: "2016-01-01", likes: 2, title: "A")
|
31
|
+
create(:post, created_at: "2016-01-01", likes: 2, title: "A")
|
32
|
+
create(:post, created_at: "2016-01-01", likes: 1, title: "B")
|
33
|
+
create(:post, created_at: "2016-01-02", likes: 1, title: "A")
|
34
34
|
end
|
35
35
|
|
36
|
-
describe
|
37
|
-
it
|
38
|
-
expect(table.headers).to eq [
|
36
|
+
describe "#headers" do
|
37
|
+
it "is a formatted list of groupers and the aggregator" do
|
38
|
+
expect(table.headers).to eq ["Created at", "Likes", "Title", "Post count"]
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
describe
|
43
|
-
it
|
44
|
-
expect(table.caption).to eq
|
42
|
+
describe "#caption" do
|
43
|
+
it "is a summary of the axes and the total record count" do
|
44
|
+
expect(table.caption).to eq "Post count by Created at, Likes, and Title for 4 Posts"
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe
|
49
|
-
it
|
48
|
+
describe "#each_row" do
|
49
|
+
it "iterates through arrays of formatted grouper values and the aggregator value" do
|
50
50
|
expect(table.each_row.to_a).to eq [
|
51
|
-
[
|
52
|
-
[
|
53
|
-
[
|
54
|
-
[
|
55
|
-
[
|
56
|
-
[
|
57
|
-
[
|
58
|
-
[
|
51
|
+
["2016-01-01", "[1.0, 2.0)", "A", 0],
|
52
|
+
["2016-01-01", "[1.0, 2.0)", "B", 1],
|
53
|
+
["2016-01-01", "[2.0, 3.0)", "A", 2],
|
54
|
+
["2016-01-01", "[2.0, 3.0)", "B", 0],
|
55
|
+
["2016-01-02", "[1.0, 2.0)", "A", 1],
|
56
|
+
["2016-01-02", "[1.0, 2.0)", "B", 0],
|
57
|
+
["2016-01-02", "[2.0, 3.0)", "A", 0],
|
58
|
+
["2016-01-02", "[2.0, 3.0)", "B", 0]
|
59
59
|
]
|
60
60
|
end
|
61
61
|
end
|
data/spec/dummy/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
2
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
3
|
|
4
|
-
require File.expand_path(
|
4
|
+
require File.expand_path("../config/application", __FILE__)
|
5
5
|
|
6
6
|
Rails.application.load_tasks
|
@@ -8,7 +8,7 @@ class PostReport < ActiveReporter::Report
|
|
8
8
|
max_aggregator :max_created_at, attribute: :created_at
|
9
9
|
average_aggregator :avg_likes, attribute: :likes
|
10
10
|
array_aggregator :post_ids, attribute: :id
|
11
|
-
category_dimension :author, model: :authors, attribute: :name, relation: ->(r) { r.joins(
|
11
|
+
category_dimension :author, model: :authors, attribute: :name, relation: ->(r) { r.joins("LEFT OUTER JOIN authors ON authors.id = posts.author_id") }
|
12
12
|
number_dimension :likes
|
13
13
|
time_dimension :created_at
|
14
14
|
end
|
@@ -3,8 +3,8 @@
|
|
3
3
|
<head>
|
4
4
|
<title>Dummy</title>
|
5
5
|
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
|
6
|
-
<%= stylesheet_link_tag
|
7
|
-
<%= javascript_include_tag
|
6
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
7
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
8
8
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
|
9
9
|
<script src="http://code.highcharts.com/highcharts.js"></script>
|
10
10
|
<%= csrf_meta_tags %>
|
@@ -3,15 +3,15 @@
|
|
3
3
|
<div class='pure-g'>
|
4
4
|
<div class='pure-u-12-24'>
|
5
5
|
<h2>Form</h2>
|
6
|
-
<%= form_tag request.fullpath, method:
|
6
|
+
<%= form_tag request.fullpath, method: "get", id: "report-form", autocomplete: "off" do %>
|
7
7
|
<%= ActiveReporter::Serializer::FormField.new(@report).html_fields %><br>
|
8
|
-
<label><%= check_box_tag
|
9
|
-
<label><%= check_box_tag
|
10
|
-
<%= submit_tag
|
8
|
+
<label><%= check_box_tag "post_report[sort_desc]", "1", @report.params[:sort_desc].present? %> Sort Desc?</label><br>
|
9
|
+
<label><%= check_box_tag "post_report[nulls_last]", "1", @report.params[:nulls_last].present? %> Nulls Last?</label><br>
|
10
|
+
<%= submit_tag "Run report", class: "pure-button pure-button-primary" %>
|
11
11
|
<% end %>
|
12
12
|
|
13
13
|
<h2>CSV</h2><br>
|
14
|
-
<%= link_to
|
14
|
+
<%= link_to "Download CSV", request.query_parameters.merge(format: "csv"), class: "pure-button pure-button-primary" %>
|
15
15
|
</div>
|
16
16
|
|
17
17
|
<div class='pure-u-12-24'>
|
data/spec/dummy/bin/bundle
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
ENV[
|
3
|
-
load Gem.bin_path(
|
2
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
|
3
|
+
load Gem.bin_path("bundler", "bundle")
|
data/spec/dummy/bin/rails
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
APP_PATH = File.expand_path(
|
3
|
-
require_relative
|
4
|
-
require
|
2
|
+
APP_PATH = File.expand_path("../../config/application", __FILE__)
|
3
|
+
require_relative "../config/boot"
|
4
|
+
require "rails/commands"
|
data/spec/dummy/bin/rake
CHANGED
data/spec/dummy/bin/setup
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require
|
2
|
+
require "pathname"
|
3
3
|
|
4
4
|
# path to your application root.
|
5
|
-
APP_ROOT = Pathname.new File.expand_path(
|
5
|
+
APP_ROOT = Pathname.new File.expand_path("../../", __FILE__)
|
6
6
|
|
7
7
|
Dir.chdir APP_ROOT do
|
8
8
|
# This script is a starting point to setup your application.
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require File.expand_path(
|
1
|
+
require File.expand_path("../boot", __FILE__)
|
2
2
|
|
3
|
-
require
|
3
|
+
require "rails/all"
|
4
4
|
|
5
5
|
Bundler.require(*Rails.groups)
|
6
6
|
require "active_reporter"
|
@@ -13,10 +13,10 @@ module Dummy
|
|
13
13
|
|
14
14
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
15
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
-
# config.time_zone =
|
16
|
+
# config.time_zone = "Central Time (US & Canada)"
|
17
17
|
|
18
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(
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join("my", "locales", "*.{rb,yml}").to_s]
|
20
20
|
# config.i18n.default_locale = :de
|
21
21
|
|
22
22
|
# Do not swallow errors in after_commit/after_rollback callbacks.
|
data/spec/dummy/config/boot.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Set up gems listed in the Gemfile.
|
2
|
-
ENV[
|
2
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile", __FILE__)
|
3
3
|
|
4
|
-
require
|
5
|
-
$LOAD_PATH.unshift File.expand_path(
|
4
|
+
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
5
|
+
$LOAD_PATH.unshift File.expand_path("../../../../lib", __FILE__)
|
@@ -11,12 +11,12 @@ defaults: &defaults
|
|
11
11
|
pool: 5
|
12
12
|
timeout: 5000
|
13
13
|
host: localhost
|
14
|
-
<<: *<%= ENV[
|
14
|
+
<<: *<%= ENV["DB"] || "postgres" %>
|
15
15
|
|
16
16
|
development:
|
17
|
-
database: <%= ENV[
|
17
|
+
database: <%= ENV["DB"] == "sqlite" ? "db/development.sqlite3" : "active_reporter_development" %>
|
18
18
|
<<: *defaults
|
19
19
|
|
20
20
|
test:
|
21
|
-
database: <%= ENV[
|
21
|
+
database: <%= ENV["DB"] == "sqlite" ? "db/test.sqlite3" : "active_reporter_test" %>
|
22
22
|
<<: *defaults
|
@@ -22,7 +22,7 @@ Rails.application.configure do
|
|
22
22
|
|
23
23
|
# Disable serving static files from the `/public` folder by default since
|
24
24
|
# Apache or NGINX already handles this.
|
25
|
-
config.serve_static_files = ENV[
|
25
|
+
config.serve_static_files = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
26
26
|
|
27
27
|
# Compress JavaScripts and CSS.
|
28
28
|
config.assets.js_compressor = :uglifier
|
@@ -38,8 +38,8 @@ Rails.application.configure do
|
|
38
38
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
39
39
|
|
40
40
|
# Specifies the header that your server uses for sending files.
|
41
|
-
# config.action_dispatch.x_sendfile_header =
|
42
|
-
# config.action_dispatch.x_sendfile_header =
|
41
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
42
|
+
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
|
43
43
|
|
44
44
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
45
45
|
# config.force_ssl = true
|
@@ -58,7 +58,7 @@ Rails.application.configure do
|
|
58
58
|
# config.cache_store = :mem_cache_store
|
59
59
|
|
60
60
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
61
|
-
# config.action_controller.asset_host =
|
61
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
62
62
|
|
63
63
|
# Ignore bad email addresses and do not raise email delivery errors.
|
64
64
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
@@ -14,7 +14,7 @@ Rails.application.configure do
|
|
14
14
|
|
15
15
|
# Configure static file server for tests with Cache-Control for performance.
|
16
16
|
config.serve_static_files = true
|
17
|
-
config.static_cache_control =
|
17
|
+
config.static_cache_control = "public, max-age=3600"
|
18
18
|
|
19
19
|
# Show full error reports and disable caching.
|
20
20
|
config.consider_all_requests_local = true
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
3
|
# Version of your assets, change this if you want to expire all your assets.
|
4
|
-
Rails.application.config.assets.version =
|
4
|
+
Rails.application.config.assets.version = "1.0"
|
5
5
|
|
6
6
|
# Add additional assets to the asset load path
|
7
7
|
# Rails.application.config.assets.paths << Emoji.images_path
|
@@ -4,13 +4,13 @@
|
|
4
4
|
# are locale specific, and you may define rules for as many different
|
5
5
|
# locales as you wish. All of these examples are active by default:
|
6
6
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
-
# inflect.plural /^(ox)$/i,
|
8
|
-
# inflect.singular /^(ox)en/i,
|
9
|
-
# inflect.irregular
|
7
|
+
# inflect.plural /^(ox)$/i, "\1en"
|
8
|
+
# inflect.singular /^(ox)en/i, "\1"
|
9
|
+
# inflect.irregular "person", "people"
|
10
10
|
# inflect.uncountable %w( fish sheep )
|
11
11
|
# end
|
12
12
|
|
13
13
|
# These inflection rules are supported but not enabled by default:
|
14
14
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
-
# inflect.acronym
|
15
|
+
# inflect.acronym "RESTful"
|
16
16
|
# end
|
data/spec/dummy/config/routes.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
root
|
2
|
+
root "site#report"
|
3
3
|
# The priority is based upon order of creation: first created -> highest priority.
|
4
4
|
# See how all your routes lay out with "rake routes".
|
5
5
|
|
6
6
|
# You can have the root of your site routed with "root"
|
7
|
-
# root
|
7
|
+
# root "welcome#index"
|
8
8
|
|
9
9
|
# Example of regular route:
|
10
|
-
# get
|
10
|
+
# get "products/:id" => "catalog#view"
|
11
11
|
|
12
12
|
# Example of named route that can be invoked with purchase_url(id: product.id)
|
13
|
-
# get
|
13
|
+
# get "products/:id/purchase" => "catalog#purchase", as: :purchase
|
14
14
|
|
15
15
|
# Example resource route (maps HTTP verbs to controller actions automatically):
|
16
16
|
# resources :products
|
@@ -18,12 +18,12 @@ Rails.application.routes.draw do
|
|
18
18
|
# Example resource route with options:
|
19
19
|
# resources :products do
|
20
20
|
# member do
|
21
|
-
# get
|
22
|
-
# post
|
21
|
+
# get "short"
|
22
|
+
# post "toggle"
|
23
23
|
# end
|
24
24
|
#
|
25
25
|
# collection do
|
26
|
-
# get
|
26
|
+
# get "sold"
|
27
27
|
# end
|
28
28
|
# end
|
29
29
|
|
@@ -37,13 +37,13 @@ Rails.application.routes.draw do
|
|
37
37
|
# resources :products do
|
38
38
|
# resources :comments
|
39
39
|
# resources :sales do
|
40
|
-
# get
|
40
|
+
# get "recent", on: :collection
|
41
41
|
# end
|
42
42
|
# end
|
43
43
|
|
44
44
|
# Example resource route with concerns:
|
45
45
|
# concern :toggleable do
|
46
|
-
# post
|
46
|
+
# post "toggle"
|
47
47
|
# end
|
48
48
|
# resources :posts, concerns: :toggleable
|
49
49
|
# resources :photos, concerns: :toggleable
|
data/spec/dummy/config.ru
CHANGED