undercarriage 0.5.0 → 0.5.7

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
  SHA256:
3
- metadata.gz: 2a9348f83d9d2e3924e13edfcb27bcea2a7602479195298e5f9e95ce646e8cb2
4
- data.tar.gz: 2f6fe5126d7b6d4db2429118dc9343f30c76609766d313937cf26790cf5ad7e8
3
+ metadata.gz: c80a0b92962c21262508fe3cfe89796a348e1b87c9e950d56e403ff114ba9c20
4
+ data.tar.gz: ec30e3665b643a807e05ca1f4ced57c385bceb5ae1a7dae6db16d72f429d0232
5
5
  SHA512:
6
- metadata.gz: e10bb005e424d5e25984ccbb92d3bf44b53ce0d4d48d220ef3f71ddc7d884f6bd97a803732c69583ea10dc15704a3d7c5dfd8ebb2548a1ade20c013344d3b8e3
7
- data.tar.gz: deb15ab41c1b0c027017c363028a4beabed9a0b92741efb418ec3d8592eb2289ac871f70c947140a7afa2e93c38175d84eae17a98c89466d902510a04501b0d6
6
+ metadata.gz: a276544a8b9343c1224d02918846fde1b426aa193a46557f3d52b2b82280c7d6ab5941a1dfe59ecefc02959c1bf72078cd19588aa01ea916dfe047b7c1b5344b
7
+ data.tar.gz: 134eec2dea285ff0a3de8521f9e0af1d2c20c4601ff1b2b07b7954a69ee00d1edb79b22939c635f7cdff9bdf4f610f248ce089142d7ccc81d04e075eaebc3407
data/README.md CHANGED
@@ -10,7 +10,7 @@ Undercarriage is a set of concerns to add to your application to trim some of th
10
10
 
11
11
  ## Requirements
12
12
 
13
- * Ruby >= 2.5
13
+ * Ruby >= 2.6
14
14
  * Rails >= 6.0
15
15
 
16
16
  ## Installation
@@ -34,6 +34,7 @@ TODO
34
34
  ## TODO
35
35
 
36
36
  * [ ] Allow a way to set locale instead of relying on browser preferred language in `Undercarriage::Controllers::LocaleConcern`
37
+ * [ ] Add support for Rails 5.2
37
38
 
38
39
  ## Testing
39
40
 
@@ -60,6 +61,13 @@ To run tests with Appraisal, run
60
61
  $ bundle exec appraisal rspec
61
62
  ```
62
63
 
64
+ To run tests with a specific version of Appraisal, run
65
+
66
+ ```
67
+ $ bundle exec appraisal rails-60 rspec
68
+ $ bundle exec appraisal rails-61 rspec
69
+ ```
70
+
63
71
  ## Code Analysis
64
72
 
65
73
  Various tools are used to ensure code is linted and formatted correctly.
@@ -21,6 +21,7 @@ module Undercarriage
21
21
  :collection_action?,
22
22
  :create_action?,
23
23
  :create_actions?,
24
+ :destroy_action?,
24
25
  :edit_action?,
25
26
  :edit_actions?,
26
27
  :index_action?,
@@ -139,6 +140,21 @@ module Undercarriage
139
140
  action?('update')
140
141
  end
141
142
 
143
+ ##
144
+ # Check if destroy
145
+ #
146
+ # Check if action is the destroy action type. The check will pass if it is a `destroy` action
147
+ #
148
+ # Usage
149
+ # destroy_action? # true
150
+ # destroy_action? # false
151
+ #
152
+ # @return [Boolean] if action is action type
153
+ #
154
+ def destroy_action?
155
+ action?('destroy')
156
+ end
157
+
142
158
  ##
143
159
  # Check if collection
144
160
  #
@@ -55,7 +55,7 @@ module Undercarriage
55
55
  nested_resource_build
56
56
 
57
57
  format.html { render :edit }
58
- format.json { render json: @post.errors, status: :unprocessable_entity }
58
+ format.json { render json: @update_resource.errors, status: :unprocessable_entity }
59
59
  end
60
60
  end
61
61
  end
@@ -74,10 +74,10 @@ module Undercarriage
74
74
  private
75
75
 
76
76
  def flash_message_builder(action, status, past_tense)
77
- defaults = flash_message_defaults(controller_name_singular_human, action, status, past_tense)
77
+ defaults = flash_message_defaults(controller_name_singular_title, action, status, past_tense)
78
78
  message = defaults.shift
79
79
 
80
- I18n.t(message, resource_name: controller_name_singular_human,
80
+ I18n.t(message, resource_name: controller_name_singular_title,
81
81
  downcase_resource_name: controller_name_singular,
82
82
  default: defaults)
83
83
  end
@@ -69,7 +69,7 @@ module Undercarriage
69
69
  end
70
70
 
71
71
  def resources_path(options = {})
72
- location_path = [resource_namespace, controller_name].compact
72
+ location_path = [resource_namespace, controller_name].compact.map(&:to_sym)
73
73
 
74
74
  polymorphic_path(location_path, options)
75
75
  end
@@ -28,11 +28,12 @@ module Undercarriage
28
28
  end
29
29
 
30
30
  ##
31
- # Singular human name
31
+ # Titleized controller name
32
32
  #
33
- def controller_name_singular_human
34
- controller_name_singular.humanize
33
+ def controller_name_singular_title
34
+ controller_name_singular.titleize
35
35
  end
36
+ alias controller_name_singular_human controller_name_singular_title
36
37
 
37
38
  ##
38
39
  # Model name
@@ -4,5 +4,5 @@ module Undercarriage
4
4
  ##
5
5
  # Undercarriage version
6
6
  #
7
- VERSION = '0.5.0'
7
+ VERSION = '0.5.7'
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: undercarriage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Freerksen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-16 00:00:00.000000000 Z
11
+ date: 2021-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails