wallaby 4.1.6 → 5.0.1

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
2
  SHA1:
3
- metadata.gz: b7937875c96f6ecc708f03cc9a71b40b06958bf3
4
- data.tar.gz: dd4f53a8a16d8e8a8e0ce2ebbf49379a89653cc7
3
+ metadata.gz: 97bd9fc25767069f94fd6d5dd0a594bfd068a8bf
4
+ data.tar.gz: 5462ca0cd790f6bfc5d01d13a4e3da7d5c72cd15
5
5
  SHA512:
6
- metadata.gz: ab1541f97dd55962b4fa24d6747f0e2e9d5ceb76c8cc4f23931cb4593ab8d67bfc221dfd0f603d75550d8d3367bd66945c5f1f72139d40f96f59d3aa0e11c687
7
- data.tar.gz: 1a8465bdbd6d6ed4b003a8ae8ded2a000f4a24b634fb872e236c24cee6edff5de5b76b910209fdf7e0c2f7c2b2933a4f2017dba54b2f6068a46f8dfcfd63d8b6
6
+ metadata.gz: f105ad40cbaa96f3f143a0f8c7aa4075e55f1b1fe2e38a0b99d2cd4e811d83aeafff524e934dd3f377b7b7cba9cadbf76751d1d37febb2389ae7b84f7f51ecde
7
+ data.tar.gz: 7f0f06a3c6291364a99e68a81b7f5d59d6dd560126205c4f999fe018c34566fffe57cbdabd5f638cd652ca06c6d5e86e43efd8b566ac2e2a4881c195fdc4cf62
@@ -5,7 +5,7 @@ module Wallaby
5
5
  before_action :authenticate_user!, except: [ :status ]
6
6
 
7
7
  def status
8
- render text: 'healthy'
8
+ render plain: 'healthy'
9
9
  end
10
10
 
11
11
  protected
@@ -65,7 +65,7 @@ module Wallaby
65
65
  protected
66
66
  def _prefixes
67
67
  @_prefixes ||= begin
68
- current_script = env['SCRIPT_NAME'].try(:[], 1..-1).presence
68
+ current_script = request.env['SCRIPT_NAME'].try(:[], 1..-1).presence
69
69
  resource_path = current_resources_name.gsub '::', '/'
70
70
  script_prefix = [ current_script, resource_path ].compact.join '/'
71
71
 
@@ -30,7 +30,7 @@ class Wallaby::ResourcesRouter
30
30
  def call(env)
31
31
  params = env['action_dispatch.request.path_parameters']
32
32
  controller = find_controller_by params[:resources]
33
- params[:action] = check_action_name_by controller, params
33
+ params[:action] = find_action_by params
34
34
 
35
35
  controller.action(params[:action]).call env
36
36
  rescue AbstractController::ActionNotFound, Wallaby::ModelNotFound => e
@@ -44,9 +44,7 @@ class Wallaby::ResourcesRouter
44
44
  Wallaby::Map.controller_map[model_class] || DEFAULT_CONTROLLER
45
45
  end
46
46
 
47
- def check_action_name_by(controller, params)
48
- params[:id].try do |id_action|
49
- id_action if controller.public_method_defined? id_action
50
- end || params[:action]
47
+ def find_action_by(params)
48
+ (params.delete(:defaults) || params)[:action]
51
49
  end
52
50
  end
@@ -4,13 +4,13 @@
4
4
  <div class="col-xs-6 col-sm-3">
5
5
  <div class="input-group">
6
6
  <span class="input-group-addon">X</span>
7
- <%= form.number_field field_name, value: value.try(:first), multiple: true, class: 'form-control' %>
7
+ <%= form.number_field field_name, value: value.try(:[], 0), multiple: true, class: 'form-control' %>
8
8
  </div>
9
9
  </div>
10
10
  <div class="col-xs-6 col-sm-3">
11
11
  <div class="input-group">
12
12
  <span class="input-group-addon">Y</span>
13
- <%= form.number_field field_name, value: value.try(:last), multiple: true, class: 'form-control' %>
13
+ <%= form.number_field field_name, value: value.try(:[], 1), multiple: true, class: 'form-control' %>
14
14
  </div>
15
15
  </div>
16
16
  </div>
@@ -1,6 +1,6 @@
1
1
  <% if value.nil? %>
2
2
  <%= null %>
3
3
  <% else %>
4
- (<span class="x"><%= value.first %></span>,
5
- <span class="y"><%= value.last %></span>)
4
+ (<span class="x"><%= value[0] %></span>,
5
+ <span class="y"><%= value[1] %></span>)
6
6
  <% end %>
@@ -1,6 +1,6 @@
1
1
  <% if value.nil? %>
2
2
  <%= null %>
3
3
  <% else %>
4
- (<span class="x"><%= value.first %></span>,
5
- <span class="y"><%= value.last %></span>)
4
+ (<span class="x"><%= value[0] %></span>,
5
+ <span class="y"><%= value[1] %></span>)
6
6
  <% end %>
data/config/routes.rb CHANGED
@@ -22,13 +22,11 @@ Wallaby::Engine.routes.draw do
22
22
  route.post '',
23
23
  defaults: { action: 'create' }
24
24
  route.match ':id',
25
- via: %i( patch put ),
25
+ via: %i( patch put ),
26
26
  defaults: { action: 'update' }
27
27
  route.delete ':id',
28
28
  defaults: { action: 'destroy' }
29
29
  end
30
- route.match ':id/:action', via: :all, as: :member
31
- route.match ':action', via: :all, as: :collection
32
30
  end
33
31
  end
34
32
  end
@@ -1,7 +1,17 @@
1
1
  class Wallaby::ActiveRecord::ModelFinder < Wallaby::ModelFinder
2
+ def base
3
+ Rails.cache.fetch 'wallaby/active_record/model_finder/base' do
4
+ if defined? ::ApplicationRecord
5
+ ::ApplicationRecord
6
+ else
7
+ ::ActiveRecord::Base
8
+ end
9
+ end
10
+ end
11
+
2
12
  def all
3
13
  Rails.cache.fetch 'wallaby/active_record/model_finder' do
4
- ActiveRecord::Base.subclasses.reject do |model_class|
14
+ base.subclasses.reject do |model_class|
5
15
  model_class.abstract_class? ||
6
16
  model_class.to_s.start_with?('#<') ||
7
17
  model_class.name == 'ActiveRecord::SchemaMigration' ||
@@ -4,7 +4,7 @@ module Wallaby::SortingHelper
4
4
 
5
5
  if metadata[:is_origin] && !metadata[:is_association] || metadata[:sort_field_name]
6
6
  sort_field_name = metadata[:sort_field_name] || field_name
7
- extra_params = next_sort_param sort_field_name
7
+ extra_params = next_sort_param(sort_field_name).permit!.to_h
8
8
  index_link(model_decorator.model_class, extra_params: extra_params) { metadata[:label] }
9
9
  else
10
10
  metadata[:label]
@@ -1,3 +1,3 @@
1
1
  module Wallaby
2
- VERSION = '4.1.6'
2
+ VERSION = '5.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wallaby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.6
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tianwen Chen
@@ -15,9 +15,6 @@ dependencies:
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '4.0'
20
- - - "<"
21
18
  - !ruby/object:Gem::Version
22
19
  version: '5.0'
23
20
  type: :runtime
@@ -25,9 +22,6 @@ dependencies:
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '4.0'
30
- - - "<"
31
25
  - !ruby/object:Gem::Version
32
26
  version: '5.0'
33
27
  - !ruby/object:Gem::Dependency
@@ -36,20 +30,14 @@ dependencies:
36
30
  requirements:
37
31
  - - ">="
38
32
  - !ruby/object:Gem::Version
39
- version: '3.5'
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '5.0'
33
+ version: '4.0'
43
34
  type: :runtime
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
38
  - - ">="
48
39
  - !ruby/object:Gem::Version
49
- version: '3.5'
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '5.0'
40
+ version: '4.0'
53
41
  - !ruby/object:Gem::Dependency
54
42
  name: kaminari
55
43
  requirement: !ruby/object:Gem::Requirement