action_args 2.3.1 → 2.3.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c2ac1aabe42af754f64ecd83e1df164647214e3d
4
- data.tar.gz: 5e6642e829771673ab64b390905108067cd844fb
2
+ SHA256:
3
+ metadata.gz: 234e515eeed335a94bc99891422b4e0374227c9d18b0cd5dcab10dc5c86a8ee2
4
+ data.tar.gz: bab6cf038df32ccc98d4921bda15b4815f039660219c8430fbf5a5f293be1cd9
5
5
  SHA512:
6
- metadata.gz: 6115f465b8836119907bdad9e57120a818304d9ba4f9fbf13f63af8f4d17a14b380beebc9f84d038f6e65d7ff094e41be45d7c4df4b34b1af70028134e867b21
7
- data.tar.gz: 25cf667565cde9b800560d9492c244b8d17df5d58894a9f4b298df7a97bcd5098f7ae33ccbd17608df640c9e664599026172baa680456dd1c8524030b5ccdc26
6
+ metadata.gz: 143f8be57fe2a24ff9ad59abc21433a3248cc64536fbdd4b2b72dbf3fcb7df4f86be0655f543e696db4b909a789e189ed7b3377b27ac5c8a9082d9d4c3546558
7
+ data.tar.gz: 8627eb5561b52f110be725779eea1382fdd9453755d7cae01ba2f7fb4b87bcd77e0207466acc15b62c9ac4f323d6688dabce8a646dfe050924f75ae43d1709df
data/.travis.yml CHANGED
@@ -3,52 +3,62 @@ language: ruby
3
3
  sudo: false
4
4
 
5
5
  before_install:
6
- - gem update --system
7
- - gem install bundler
6
+ - "ruby -e 'exit RUBY_VERSION.to_f >= 2.3' && gem up --system || gem i rubygems-update -v '<3' && update_rubygems"
7
+ - gem up bundler
8
+
9
+ # rvm:
10
+ # - 2.6.0
11
+ # - 2.5.3
12
+ # - 2.4.5
13
+ # - 2.3.7
14
+ # - 2.2.10
15
+ # - 2.1.10
16
+ # - 2.0.0
17
+ # - ruby-head
18
+ # gemfile:
19
+ # - gemfiles/rails_52.gemfile
20
+ # - gemfiles/rails_51.gemfile
21
+ # - gemfiles/rails_50.gemfile
22
+ # - gemfiles/rails_42.gemfile
23
+ # - gemfiles/rails_41.gemfile
24
+ # - gemfiles/rails_edge.gemfile
8
25
 
9
- rvm:
10
- - 2.5.0
11
- - 2.4.3
12
- - 2.3.6
13
- - 2.2.9
14
- - 2.1.10
15
- - 2.0.0
16
- - ruby-head
17
- - jruby-9.1.15.0
18
- - rubinius-3
19
26
  matrix:
20
- exclude:
21
- - rvm: 2.5.0
22
- gemfile: gemfiles/rails_42.gemfile
23
- - rvm: 2.5.0
24
- gemfile: gemfiles/rails_41.gemfile
25
- - rvm: 2.4.3
26
- gemfile: gemfiles/rails_42.gemfile
27
- - rvm: 2.4.3
28
- gemfile: gemfiles/rails_41.gemfile
29
- - rvm: 2.1.10
27
+ include:
28
+ - rvm: 2.6.0
29
+ gemfile: gemfiles/rails_52.gemfile
30
+ - rvm: 2.6.0
30
31
  gemfile: gemfiles/rails_51.gemfile
31
- - rvm: 2.0.0
32
- gemfile: gemfiles/rails_51.gemfile
33
- - rvm: 2.1.10
34
- gemfile: gemfiles/rails_50.gemfile
35
- - rvm: 2.0.0
32
+ - rvm: 2.6.0
36
33
  gemfile: gemfiles/rails_50.gemfile
37
- - rvm: 2.1.10
34
+ - rvm: 2.6.0
38
35
  gemfile: gemfiles/rails_edge.gemfile
36
+ - rvm: 2.5.3
37
+ gemfile: gemfiles/rails_52.gemfile
38
+ - rvm: 2.4.5
39
+ gemfile: gemfiles/rails_52.gemfile
40
+ - rvm: 2.3.8
41
+ gemfile: gemfiles/rails_52.gemfile
42
+ - rvm: 2.2.10
43
+ gemfile: gemfiles/rails_42.gemfile
44
+ - rvm: 2.2.10
45
+ gemfile: gemfiles/rails_41.gemfile
46
+ - rvm: 2.1.10
47
+ gemfile: gemfiles/rails_42.gemfile
39
48
  - rvm: 2.0.0
40
- gemfile: gemfiles/rails_edge.gemfile
41
- - rvm: ruby-head
42
49
  gemfile: gemfiles/rails_42.gemfile
50
+
43
51
  - rvm: ruby-head
44
- gemfile: gemfiles/rails_41.gemfile
52
+ gemfile: gemfiles/rails_52.gemfile
53
+ - rvm: ruby-head
54
+ gemfile: gemfiles/rails_edge.gemfile
55
+
56
+ - rvm: jruby-9.2.0.0
57
+ gemfile: gemfiles/rails_52.gemfile
58
+ - rvm: rubinius-3
59
+ gemfile: gemfiles/rails_52.gemfile
60
+
45
61
  allow_failures:
46
- - rvm: jruby-9.1.15.0
62
+ - rvm: jruby-9.2.0.0
47
63
  - rvm: rubinius-3
48
64
  - gemfile: gemfiles/rails_edge.gemfile
49
- gemfile:
50
- - gemfiles/rails_51.gemfile
51
- - gemfiles/rails_50.gemfile
52
- - gemfiles/rails_42.gemfile
53
- - gemfiles/rails_41.gemfile
54
- - gemfiles/rails_edge.gemfile
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
 
4
5
  # Specify your gem's dependencies in action_args.gemspec
data/README.md CHANGED
@@ -157,7 +157,6 @@ The following elegant controller code will be generated:
157
157
 
158
158
  ```ruby
159
159
  class UsersController < ApplicationController
160
- before_action :set_user, only: [:show, :edit, :update, :destroy]
161
160
  permits :name, :age, :email
162
161
 
163
162
  # GET /users
@@ -166,7 +165,8 @@ class UsersController < ApplicationController
166
165
  end
167
166
 
168
167
  # GET /users/1
169
- def show
168
+ def show(id)
169
+ @user = User.find(id)
170
170
  end
171
171
 
172
172
  # GET /users/new
@@ -175,7 +175,8 @@ class UsersController < ApplicationController
175
175
  end
176
176
 
177
177
  # GET /users/1/edit
178
- def edit
178
+ def edit(id)
179
+ @user = User.find(id)
179
180
  end
180
181
 
181
182
  # POST /users
@@ -185,31 +186,28 @@ class UsersController < ApplicationController
185
186
  if @user.save
186
187
  redirect_to @user, notice: 'User was successfully created.'
187
188
  else
188
- render action: 'new'
189
+ render :new
189
190
  end
190
191
  end
191
192
 
192
193
  # PUT /users/1
193
- def update(user)
194
- if @user.update_attributes(user)
194
+ def update(id, user)
195
+ @user = User.find(id)
196
+
197
+ if @user.update(user)
195
198
  redirect_to @user, notice: 'User was successfully updated.'
196
199
  else
197
- render action: 'edit'
200
+ render :edit
198
201
  end
199
202
  end
200
203
 
201
204
  # DELETE /users/1
202
- def destroy
205
+ def destroy(id)
206
+ @user = User.find(id)
203
207
  @user.destroy
204
208
 
205
- redirect_to users_url
209
+ redirect_to users_url, notice: 'User was successfully destroyed.'
206
210
  end
207
-
208
- private
209
- # Use callbacks to share common setup or constraints between actions.
210
- def set_user(id)
211
- @user = User.find(id)
212
- end
213
211
  end
214
212
  ```
215
213
 
@@ -221,9 +219,9 @@ You may notice that
221
219
 
222
220
  ## Supported versions
223
221
 
224
- * Ruby 2.0.0, 2.1.x, 2.2.x, 2.3.x, 2.4.x, 2.5.0 (trunk), JRuby, & Rubinius with 2.0+ mode
222
+ * Ruby 2.0.0, 2.1.x, 2.2.x, 2.3.x, 2.4.x, 2.5.x, 2.6.x, 2.7.0 (trunk), JRuby, & Rubinius with 2.0+ mode
225
223
 
226
- * Rails 4.1.x, 4.2.x, 5.0, 5.1 (edge)
224
+ * Rails 4.1.x, 4.2.x, 5.0, 5.1, 5.2, 6.0 (edge)
227
225
 
228
226
  Please use Version 1.5.4 for Rails 4.0.x.
229
227
 
data/action_args.gemspec CHANGED
@@ -1,5 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  # frozen_string_literal: true
3
+
3
4
  $:.push File.expand_path("../lib", __FILE__)
4
5
  require 'action_args/version'
5
6
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
 
4
5
  gem 'rails', '~> 4.1.0'
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
 
4
5
  gem 'rails', '~> 4.2.0'
@@ -1,9 +1,6 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
- git_source(:github) do |repo_name|
4
- repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
5
- "https://github.com/#{repo_name}.git"
6
- end
7
4
 
8
5
  gem 'rails', '~> 5.0.1'
9
6
 
@@ -1,9 +1,6 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
- git_source(:github) do |repo_name|
4
- repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
5
- "https://github.com/#{repo_name}.git"
6
- end
7
4
 
8
5
  gem 'rails', '~> 5.1.0'
9
6
 
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'rails', '~> 5.2.0'
6
+
7
+ gem 'rails-controller-testing'
8
+
9
+ gemspec :path => '../'
10
+
11
+ platforms :ruby do
12
+ gem 'sqlite3'
13
+ end
14
+
15
+ platforms :jruby do
16
+ gem 'activerecord-jdbcsqlite3-adapter'
17
+ end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
  git_source(:github) do |repo_name|
4
5
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
data/lib/action_args.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'action_args/params_handler'
3
4
  require 'action_args/abstract_controller'
4
5
  require 'action_args/callbacks'
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative 'params_handler'
3
4
  using ActionArgs::ParamsHandler
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  using ActionArgs::ParamsHandler
3
4
 
4
5
  module ActionArgs
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module ActionArgs
3
4
  module ParamsHandler
4
5
  refine AbstractController::Base do
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module ActionArgs
3
- VERSION = '2.3.1'
4
+ VERSION = '2.3.2'
4
5
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # load original rails scaffold_controller generator
3
4
  require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
4
5
 
@@ -6,7 +7,7 @@ require 'rails/generators/rails/scaffold_controller/scaffold_controller_generato
6
7
  module Rails
7
8
  module Generators
8
9
  class ActionArgsScaffoldControllerGenerator < ::Rails::Generators::ScaffoldControllerGenerator
9
- argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
10
+ argument :attributes, type: :array, default: [], banner: 'field:type field:type'
10
11
  source_root File.expand_path('../templates', __FILE__)
11
12
  end
12
13
  end
@@ -1,5 +1,4 @@
1
1
  class <%= controller_class_name %>Controller < ApplicationController
2
- before_action :set_<%= singular_table_name %>, only: [:show, :edit, :update, :destroy]
3
2
  <% if defined? ActionController::StrongParameters -%>
4
3
  permits <%= attributes.map {|a| ":#{a.name}" }.join(', ') %>
5
4
 
@@ -10,7 +9,8 @@ class <%= controller_class_name %>Controller < ApplicationController
10
9
  end
11
10
 
12
11
  # GET <%= route_url %>/1
13
- def show
12
+ def show(id)
13
+ @<%= singular_table_name %> = <%= orm_class.find(class_name, 'id') %>
14
14
  end
15
15
 
16
16
  # GET <%= route_url %>/new
@@ -19,7 +19,8 @@ class <%= controller_class_name %>Controller < ApplicationController
19
19
  end
20
20
 
21
21
  # GET <%= route_url %>/1/edit
22
- def edit
22
+ def edit(id)
23
+ @<%= singular_table_name %> = <%= orm_class.find(class_name, 'id') %>
23
24
  end
24
25
 
25
26
  # POST <%= route_url %>
@@ -34,7 +35,9 @@ class <%= controller_class_name %>Controller < ApplicationController
34
35
  end
35
36
 
36
37
  # PUT <%= route_url %>/1
37
- def update(<%= singular_table_name %>)
38
+ def update(id, <%= singular_table_name %>)
39
+ @<%= singular_table_name %> = <%= orm_class.find(class_name, 'id') %>
40
+
38
41
  <% if orm_instance.respond_to? :update -%>
39
42
  if @<%= orm_instance.update(singular_table_name) %>
40
43
  <% else -%>
@@ -47,15 +50,10 @@ class <%= controller_class_name %>Controller < ApplicationController
47
50
  end
48
51
 
49
52
  # DELETE <%= route_url %>/1
50
- def destroy
53
+ def destroy(id)
54
+ @<%= singular_table_name %> = <%= orm_class.find(class_name, 'id') %>
51
55
  @<%= orm_instance.destroy %>
52
56
 
53
57
  redirect_to <%= index_helper %>_url, notice: <%= "'#{human_name} was successfully destroyed.'" %>
54
58
  end
55
-
56
- private
57
- # Use callbacks to share common setup or constraints between actions.
58
- def set_<%= singular_table_name %>(id)
59
- @<%= singular_table_name %> = <%= orm_class.find(class_name, 'id') %>
60
- end
61
59
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'test_helper'
3
4
 
4
5
  class BooksControllerTest < ActionController::TestCase
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'test_helper'
3
4
 
4
5
  class BooksControllerTest < ActionController::TestCase
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'test_helper'
3
4
 
4
5
  class KwBooksControllerTest < ActionController::TestCase
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'test_helper'
3
4
 
4
5
  class KwKeyreqBooksControllerTest < ActionController::TestCase
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'test_helper'
3
4
 
4
5
  class AuthorsControllerTest < ActionController::TestCase
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'test_helper'
3
4
 
4
5
  class StoresControllerTest < ActionController::TestCase
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # this file should not be loaded from Ruby <2.0
3
4
 
4
5
  class KwBooksController < ApplicationController
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # this file should not be loaded from Ruby <2.1
3
4
 
4
5
  class KwKeyreqBooksController < ApplicationController
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'test_helper'
3
4
 
4
5
  class UserMailerTest < ActionMailer::TestCase
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'test_helper'
3
4
  using ActionArgs::ParamsHandler
4
5
 
data/test/test_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
4
  $LOAD_PATH.unshift(File.dirname(__FILE__))
4
5
  # load Rails first
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_args
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-27 00:00:00.000000000 Z
11
+ date: 2019-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -71,6 +71,7 @@ files:
71
71
  - gemfiles/rails_42.gemfile
72
72
  - gemfiles/rails_50.gemfile
73
73
  - gemfiles/rails_51.gemfile
74
+ - gemfiles/rails_52.gemfile
74
75
  - gemfiles/rails_edge.gemfile
75
76
  - lib/action_args.rb
76
77
  - lib/action_args/abstract_controller.rb
@@ -110,8 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  - !ruby/object:Gem::Version
111
112
  version: '0'
112
113
  requirements: []
113
- rubyforge_project:
114
- rubygems_version: 2.5.2.2
114
+ rubygems_version: 3.0.1
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: Controller action arguments parameterizer for Rails 4+ & Ruby 2.0+