instant-api 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/Gemfile +14 -0
  4. data/Gemfile.lock +142 -0
  5. data/README.md +231 -0
  6. data/instant_api.gemspec +20 -0
  7. data/lib/instant_api.rb +13 -0
  8. data/lib/instant_api/controller/build_create.rb +34 -0
  9. data/lib/instant_api/controller/build_destroy.rb +23 -0
  10. data/lib/instant_api/controller/build_edit.rb +11 -0
  11. data/lib/instant_api/controller/build_index.rb +39 -0
  12. data/lib/instant_api/controller/build_new.rb +22 -0
  13. data/lib/instant_api/controller/build_resource.rb +29 -0
  14. data/lib/instant_api/controller/build_show.rb +25 -0
  15. data/lib/instant_api/controller/build_update.rb +46 -0
  16. data/lib/instant_api/controller/builder.rb +54 -0
  17. data/lib/instant_api/controller/exception_handler.rb +38 -0
  18. data/lib/instant_api/controller/parameters.rb +43 -0
  19. data/lib/instant_api/controller/routes.rb +46 -0
  20. data/lib/instant_api/model/active_record_query_builder.rb +36 -0
  21. data/lib/instant_api/model/association_reflector.rb +93 -0
  22. data/lib/instant_api/model/builder.rb +95 -0
  23. data/lib/instant_api/model/collection.rb +43 -0
  24. data/lib/instant_api/model/resource.rb +14 -0
  25. data/lib/instant_api/util/array.rb +15 -0
  26. data/lib/instant_api/version.rb +3 -0
  27. data/spec/dummy/Gemfile +58 -0
  28. data/spec/dummy/Gemfile.lock +193 -0
  29. data/spec/dummy/Rakefile +6 -0
  30. data/spec/dummy/app/assets/images/.keep +0 -0
  31. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  32. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  33. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  34. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  35. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  36. data/spec/dummy/app/mailers/.keep +0 -0
  37. data/spec/dummy/app/models/.keep +0 -0
  38. data/spec/dummy/app/models/a.rb +5 -0
  39. data/spec/dummy/app/models/address.rb +4 -0
  40. data/spec/dummy/app/models/b.rb +4 -0
  41. data/spec/dummy/app/models/c.rb +4 -0
  42. data/spec/dummy/app/models/concerns/.keep +0 -0
  43. data/spec/dummy/app/models/country.rb +4 -0
  44. data/spec/dummy/app/models/d.rb +3 -0
  45. data/spec/dummy/app/models/movie.rb +4 -0
  46. data/spec/dummy/app/models/user.rb +8 -0
  47. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  48. data/spec/dummy/bin/bundle +3 -0
  49. data/spec/dummy/bin/rails +4 -0
  50. data/spec/dummy/bin/rake +4 -0
  51. data/spec/dummy/config.ru +4 -0
  52. data/spec/dummy/config/application.rb +23 -0
  53. data/spec/dummy/config/boot.rb +4 -0
  54. data/spec/dummy/config/database.yml +39 -0
  55. data/spec/dummy/config/environment.rb +5 -0
  56. data/spec/dummy/config/environments/development.rb +29 -0
  57. data/spec/dummy/config/environments/production.rb +80 -0
  58. data/spec/dummy/config/environments/test.rb +36 -0
  59. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  60. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  61. data/spec/dummy/config/initializers/inflections.rb +16 -0
  62. data/spec/dummy/config/initializers/instant_api.rb +3 -0
  63. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  64. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  65. data/spec/dummy/config/initializers/session_store.rb +3 -0
  66. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  67. data/spec/dummy/config/locales/en.yml +23 -0
  68. data/spec/dummy/config/routes.rb +3 -0
  69. data/spec/dummy/db/migrate/20131019140756_create_users.rb +14 -0
  70. data/spec/dummy/db/migrate/20131019141942_create_addresses.rb +14 -0
  71. data/spec/dummy/db/migrate/20131020003152_a.rb +9 -0
  72. data/spec/dummy/db/migrate/20131020003245_b.rb +10 -0
  73. data/spec/dummy/db/migrate/20131020003354_c.rb +11 -0
  74. data/spec/dummy/db/migrate/20131020164202_d.rb +9 -0
  75. data/spec/dummy/db/migrate/20131020164349_ad.rb +8 -0
  76. data/spec/dummy/db/migrate/20140419205834_create_countries.rb +9 -0
  77. data/spec/dummy/db/migrate/20140421005321_create_movies.rb +8 -0
  78. data/spec/dummy/db/migrate/20140421005435_create_countries_movies.rb +8 -0
  79. data/spec/dummy/db/schema.rb +88 -0
  80. data/spec/dummy/db/seeds.rb +7 -0
  81. data/spec/dummy/lib/assets/.keep +0 -0
  82. data/spec/dummy/lib/tasks/.keep +0 -0
  83. data/spec/dummy/log/.keep +0 -0
  84. data/spec/dummy/public/404.html +58 -0
  85. data/spec/dummy/public/422.html +58 -0
  86. data/spec/dummy/public/500.html +57 -0
  87. data/spec/dummy/public/favicon.ico +0 -0
  88. data/spec/dummy/public/robots.txt +5 -0
  89. data/spec/dummy/vendor/assets/javascripts/.keep +0 -0
  90. data/spec/dummy/vendor/assets/stylesheets/.keep +0 -0
  91. data/spec/factories/address_factory.rb +8 -0
  92. data/spec/factories/country_factory.rb +5 -0
  93. data/spec/factories/movies_factory.rb +5 -0
  94. data/spec/factories/user_factory.rb +10 -0
  95. data/spec/functional/create_spec.rb +16 -0
  96. data/spec/functional/destroy_spec.rb +21 -0
  97. data/spec/functional/edit_spec.rb +19 -0
  98. data/spec/functional/index_spec.rb +82 -0
  99. data/spec/functional/new_spec.rb +14 -0
  100. data/spec/functional/show_spec.rb +20 -0
  101. data/spec/functional/update_spec.rb +47 -0
  102. data/spec/spec_helper.rb +34 -0
  103. data/spec/support/database_cleaner.rb +20 -0
  104. data/spec/support/helpers.rb +31 -0
  105. data/spec/unit/lib/instant_api/controller/build_create_spec.rb +38 -0
  106. data/spec/unit/lib/instant_api/controller/build_destroy_spec.rb +25 -0
  107. data/spec/unit/lib/instant_api/controller/build_edit_spec.rb +24 -0
  108. data/spec/unit/lib/instant_api/controller/build_index_spec.rb +49 -0
  109. data/spec/unit/lib/instant_api/controller/build_new_spec.rb +18 -0
  110. data/spec/unit/lib/instant_api/controller/build_resource_spec.rb +27 -0
  111. data/spec/unit/lib/instant_api/controller/build_show_spec.rb +24 -0
  112. data/spec/unit/lib/instant_api/controller/build_update_spec.rb +66 -0
  113. data/spec/unit/lib/instant_api/controller/builder_spec.rb +18 -0
  114. data/spec/unit/lib/instant_api/controller/parameters_spec.rb +53 -0
  115. data/spec/unit/lib/instant_api/model/active_record_query_builder_spec.rb +133 -0
  116. data/spec/unit/lib/instant_api/model/builder_spec.rb +237 -0
  117. data/spec/unit/lib/instant_api/model/join_calculator_spec.rb +27 -0
  118. metadata +202 -0
@@ -0,0 +1,95 @@
1
+ # InstanceBuilder
2
+ module InstantApi::Model
3
+ class Builder
4
+ attr_reader :params, :klass, :root
5
+
6
+ def initialize(params, klass, root = false)
7
+ @params = params
8
+ @klass = klass
9
+ @root = root
10
+ end
11
+
12
+ def build
13
+ record = nil
14
+ klass.transaction do
15
+ record = klass.create(params_primitives).tap do |object|
16
+ create_nested_records(object)
17
+ end
18
+
19
+ raise ActiveRecord::Rollback if rollback?(record)
20
+ end
21
+
22
+ record
23
+ end
24
+
25
+ private
26
+
27
+ def rollback?(record)
28
+ root && record.invalid?
29
+ end
30
+
31
+ def params_primitives
32
+ params_for_klass.select { |_, v| !v.is_a?(Enumerable) }
33
+ end
34
+
35
+ def params_enumerables
36
+ params_for_klass.select { |_, v| v.is_a?(Enumerable) }
37
+ end
38
+
39
+ def params_for_klass
40
+ @params_for_klass ||= begin
41
+ name = klass.name.underscore
42
+ klass_params = params[name] ? params[name] : params
43
+ klass_params.select { |k, _| klass_attributes.index(k) }
44
+ end
45
+ end
46
+
47
+ def klass_attributes
48
+ @klass_attributes ||= plain_attributes + association_attributes
49
+ end
50
+
51
+ def plain_attributes_confirmation
52
+ validator_class = ActiveModel::Validations::ConfirmationValidator
53
+ klass.column_names.select do |column|
54
+ validators = klass.validators_on(column)
55
+ validators.select { |validator| validator.is_a?(validator_class) }.any?
56
+ end.map { |column| "#{column}_confirmation" }
57
+ end
58
+
59
+ def plain_attributes
60
+ klass.column_names + plain_attributes_confirmation
61
+ end
62
+
63
+ ASSOCIATION_TYPES = [:belongs_to, :has_many, :has_one, :has_and_belongs_to_many]
64
+ def association_attributes
65
+ ASSOCIATION_TYPES.map do |type|
66
+ klass.reflect_on_all_associations(type).map(&:name).map(&:to_s)
67
+ end.flatten
68
+ end
69
+
70
+ def create_nested_records(record)
71
+ params_enumerables.each do |nested_name, nested_params|
72
+ if (association = klass.reflections[nested_name.to_sym])
73
+ nested_object = create_nested_record(nested_name, nested_params)
74
+ add_association(record, association.macro, nested_name, nested_object)
75
+ end
76
+ end
77
+ end
78
+
79
+ def add_association(record, association_type, nested_name, nested_object)
80
+ case association_type
81
+ when :has_many, :has_and_belongs_to_many
82
+ record.send(nested_name) << nested_object
83
+ when :has_one, :belongs_to
84
+ record.send("#{nested_name}=", nested_object)
85
+ record.save
86
+ end
87
+ end
88
+
89
+ def create_nested_record(nested_name, nested_params)
90
+ nested_class = nested_name.classify.constantize
91
+ new_params = {nested_name => nested_params}.with_indifferent_access
92
+ InstantApi::Model::Builder.new(new_params, nested_class).build
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,43 @@
1
+ require 'instant_api/model/active_record_query_builder'
2
+
3
+ module InstantApi::Model
4
+ class Collection
5
+ attr_reader :params, :query_builder
6
+
7
+ def initialize(klass, params)
8
+ @params = params
9
+ @query_builder = InstantApi::Model::ActiveRecordQueryBuilder.new(klass)
10
+ end
11
+
12
+ def page
13
+ @page ||= [(params[:page] || 1).to_i, 1].max
14
+ end
15
+
16
+ def per_page
17
+ @per_page ||= begin
18
+ aux = (params[:per_page] || 10).to_i
19
+ if aux < 1
20
+ aux = 10
21
+ end
22
+ [aux, 10].min
23
+ end
24
+ end
25
+
26
+ def count
27
+ collection.count
28
+ end
29
+
30
+ def collection
31
+ @collection ||= query_builder.query(params)
32
+ end
33
+
34
+ def paginated_collection
35
+ collection_to_paginate = if collection.is_a?(Array)
36
+ Kaminari::paginate_array(collection)
37
+ else
38
+ collection
39
+ end
40
+ collection_to_paginate.page(page).per(per_page)
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,14 @@
1
+ module InstantApi::Model
2
+ class Resource
3
+ attr_reader :params, :query_builder
4
+
5
+ def initialize(klass, params)
6
+ @params = params
7
+ @query_builder = InstantApi::Model::ActiveRecordQueryBuilder.new(klass)
8
+ end
9
+
10
+ def find
11
+ query_builder.find_first(params)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+
2
+ class Array
3
+ # [a] -> a
4
+ # [a, b, c] -> { a => { b => c } }
5
+ def array_to_hash
6
+ head, *tail = *self
7
+ if tail.empty?
8
+ head
9
+ elsif tail.size == 1
10
+ {head => tail.first}
11
+ else
12
+ {head => tail.array_to_hash}
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module InstantApi
2
+ VERSION = '0.1.1'.freeze
3
+ end
@@ -0,0 +1,58 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
4
+ gem 'rails', '4.0.2'
5
+
6
+ # Use mysql as the database for Active Record
7
+
8
+
9
+ # Use SCSS for stylesheets
10
+ gem 'sass-rails', '~> 4.0.1'
11
+
12
+ # Use Uglifier as compressor for JavaScript assets
13
+ gem 'uglifier', '>= 1.3.0'
14
+
15
+ # Use CoffeeScript for .js.coffee assets and views
16
+ gem 'coffee-rails', '~> 4.0.1'
17
+
18
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
19
+ # gem 'therubyracer', platforms: :ruby
20
+
21
+ # Use jquery as the JavaScript library
22
+ gem 'jquery-rails'
23
+
24
+ # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
25
+ gem 'turbolinks'
26
+
27
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
28
+ gem 'jbuilder', '~> 1.2'
29
+
30
+ group :doc do
31
+ # bundle exec rake doc:rails generates the API under doc/api.
32
+ gem 'sdoc', require: false
33
+ end
34
+
35
+ # Use ActiveModel has_secure_password
36
+ gem 'bcrypt-ruby', '~> 3.0.0'
37
+
38
+ # Use unicorn as the app server
39
+ gem 'unicorn'
40
+
41
+ # Use Capistrano for deployment
42
+ gem 'capistrano', group: :development
43
+
44
+ # Use debugger
45
+ # gem 'debugger', group: [:development, :test]
46
+
47
+ gem 'kaminari'
48
+
49
+ group :test do
50
+ gem 'factory_girl_rails', '~> 4.2.1'
51
+ gem 'rspec-rails', '~> 2.14.0'
52
+ gem 'shoulda-matchers', '~> 2.3.0'
53
+ gem 'fuubar', '~> 1.2.0'
54
+ gem 'ffaker', '~> 1.18.0'
55
+ gem 'database_cleaner', '~> 1.1.1'
56
+ gem 'webmock', '~> 1.13.0'
57
+ gem 'mysql2'
58
+ end
@@ -0,0 +1,193 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ actionmailer (4.0.2)
5
+ actionpack (= 4.0.2)
6
+ mail (~> 2.5.4)
7
+ actionpack (4.0.2)
8
+ activesupport (= 4.0.2)
9
+ builder (~> 3.1.0)
10
+ erubis (~> 2.7.0)
11
+ rack (~> 1.5.2)
12
+ rack-test (~> 0.6.2)
13
+ activemodel (4.0.2)
14
+ activesupport (= 4.0.2)
15
+ builder (~> 3.1.0)
16
+ activerecord (4.0.2)
17
+ activemodel (= 4.0.2)
18
+ activerecord-deprecated_finders (~> 1.0.2)
19
+ activesupport (= 4.0.2)
20
+ arel (~> 4.0.0)
21
+ activerecord-deprecated_finders (1.0.3)
22
+ activesupport (4.0.2)
23
+ i18n (~> 0.6, >= 0.6.4)
24
+ minitest (~> 4.2)
25
+ multi_json (~> 1.3)
26
+ thread_safe (~> 0.1)
27
+ tzinfo (~> 0.3.37)
28
+ addressable (2.3.5)
29
+ arel (4.0.2)
30
+ atomic (1.1.15)
31
+ bcrypt-ruby (3.0.1)
32
+ builder (3.1.4)
33
+ capistrano (3.0.1)
34
+ i18n
35
+ rake (>= 10.0.0)
36
+ sshkit (>= 0.0.23)
37
+ coffee-rails (4.0.1)
38
+ coffee-script (>= 2.2.0)
39
+ railties (>= 4.0.0, < 5.0)
40
+ coffee-script (2.2.0)
41
+ coffee-script-source
42
+ execjs
43
+ coffee-script-source (1.7.0)
44
+ crack (0.4.2)
45
+ safe_yaml (~> 1.0.0)
46
+ database_cleaner (1.1.1)
47
+ diff-lcs (1.2.5)
48
+ erubis (2.7.0)
49
+ execjs (2.0.2)
50
+ factory_girl (4.2.0)
51
+ activesupport (>= 3.0.0)
52
+ factory_girl_rails (4.2.1)
53
+ factory_girl (~> 4.2.0)
54
+ railties (>= 3.0.0)
55
+ ffaker (1.18.0)
56
+ fuubar (1.2.1)
57
+ rspec (~> 2.0)
58
+ rspec-instafail (~> 0.2.0)
59
+ ruby-progressbar (~> 1.0)
60
+ hike (1.2.3)
61
+ i18n (0.6.9)
62
+ jbuilder (1.5.3)
63
+ activesupport (>= 3.0.0)
64
+ multi_json (>= 1.2.0)
65
+ jquery-rails (3.1.0)
66
+ railties (>= 3.0, < 5.0)
67
+ thor (>= 0.14, < 2.0)
68
+ json (1.8.1)
69
+ kaminari (0.15.1)
70
+ actionpack (>= 3.0.0)
71
+ activesupport (>= 3.0.0)
72
+ kgio (2.8.1)
73
+ mail (2.5.4)
74
+ mime-types (~> 1.16)
75
+ treetop (~> 1.4.8)
76
+ mime-types (1.25.1)
77
+ minitest (4.7.5)
78
+ multi_json (1.8.4)
79
+ mysql2 (0.3.15)
80
+ net-scp (1.1.2)
81
+ net-ssh (>= 2.6.5)
82
+ net-ssh (2.7.0)
83
+ polyglot (0.3.4)
84
+ rack (1.5.2)
85
+ rack-test (0.6.2)
86
+ rack (>= 1.0)
87
+ rails (4.0.2)
88
+ actionmailer (= 4.0.2)
89
+ actionpack (= 4.0.2)
90
+ activerecord (= 4.0.2)
91
+ activesupport (= 4.0.2)
92
+ bundler (>= 1.3.0, < 2.0)
93
+ railties (= 4.0.2)
94
+ sprockets-rails (~> 2.0.0)
95
+ railties (4.0.2)
96
+ actionpack (= 4.0.2)
97
+ activesupport (= 4.0.2)
98
+ rake (>= 0.8.7)
99
+ thor (>= 0.18.1, < 2.0)
100
+ raindrops (0.12.0)
101
+ rake (10.1.1)
102
+ rdoc (4.1.1)
103
+ json (~> 1.4)
104
+ rspec (2.14.1)
105
+ rspec-core (~> 2.14.0)
106
+ rspec-expectations (~> 2.14.0)
107
+ rspec-mocks (~> 2.14.0)
108
+ rspec-core (2.14.8)
109
+ rspec-expectations (2.14.5)
110
+ diff-lcs (>= 1.1.3, < 2.0)
111
+ rspec-instafail (0.2.4)
112
+ rspec-mocks (2.14.6)
113
+ rspec-rails (2.14.1)
114
+ actionpack (>= 3.0)
115
+ activemodel (>= 3.0)
116
+ activesupport (>= 3.0)
117
+ railties (>= 3.0)
118
+ rspec-core (~> 2.14.0)
119
+ rspec-expectations (~> 2.14.0)
120
+ rspec-mocks (~> 2.14.0)
121
+ ruby-progressbar (1.4.2)
122
+ safe_yaml (1.0.1)
123
+ sass (3.2.14)
124
+ sass-rails (4.0.1)
125
+ railties (>= 4.0.0, < 5.0)
126
+ sass (>= 3.1.10)
127
+ sprockets-rails (~> 2.0.0)
128
+ sdoc (0.4.0)
129
+ json (~> 1.8)
130
+ rdoc (~> 4.0, < 5.0)
131
+ shoulda-matchers (2.3.0)
132
+ activesupport (>= 3.0.0)
133
+ sprockets (2.11.0)
134
+ hike (~> 1.2)
135
+ multi_json (~> 1.0)
136
+ rack (~> 1.0)
137
+ tilt (~> 1.1, != 1.3.0)
138
+ sprockets-rails (2.0.1)
139
+ actionpack (>= 3.0)
140
+ activesupport (>= 3.0)
141
+ sprockets (~> 2.8)
142
+ sshkit (1.3.0)
143
+ net-scp (>= 1.1.2)
144
+ net-ssh
145
+ term-ansicolor
146
+ term-ansicolor (1.2.2)
147
+ tins (~> 0.8)
148
+ thor (0.18.1)
149
+ thread_safe (0.2.0)
150
+ atomic (>= 1.1.7, < 2)
151
+ tilt (1.4.1)
152
+ tins (0.13.1)
153
+ treetop (1.4.15)
154
+ polyglot
155
+ polyglot (>= 0.3.1)
156
+ turbolinks (2.2.1)
157
+ coffee-rails
158
+ tzinfo (0.3.38)
159
+ uglifier (2.4.0)
160
+ execjs (>= 0.3.0)
161
+ json (>= 1.8.0)
162
+ unicorn (4.7.0)
163
+ kgio (~> 2.6)
164
+ rack
165
+ raindrops (~> 0.7)
166
+ webmock (1.13.0)
167
+ addressable (>= 2.2.7)
168
+ crack (>= 0.3.2)
169
+
170
+ PLATFORMS
171
+ ruby
172
+
173
+ DEPENDENCIES
174
+ bcrypt-ruby (~> 3.0.0)
175
+ capistrano
176
+ coffee-rails (~> 4.0.1)
177
+ database_cleaner (~> 1.1.1)
178
+ factory_girl_rails (~> 4.2.1)
179
+ ffaker (~> 1.18.0)
180
+ fuubar (~> 1.2.0)
181
+ jbuilder (~> 1.2)
182
+ jquery-rails
183
+ kaminari
184
+ mysql2
185
+ rails (= 4.0.2)
186
+ rspec-rails (~> 2.14.0)
187
+ sass-rails (~> 4.0.1)
188
+ sdoc
189
+ shoulda-matchers (~> 2.3.0)
190
+ turbolinks
191
+ uglifier (>= 1.3.0)
192
+ unicorn
193
+ webmock (~> 1.13.0)
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ InstantApi::Application.load_tasks
File without changes
@@ -0,0 +1,16 @@
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 jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
16
+ //= require_tree