hot-glue 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81ca38b1bfb68e173a1665d924729b04afa26ccda900d707508a64e01977f1ad
4
- data.tar.gz: 8d2b98c07d84ec264600d79f5073139ea717a3b66488b5b269a4466bc5eb04be
3
+ metadata.gz: bdf1a3b7bd321bbf889e50829d778303457eaa91c2da5687874c80f9accd7ebd
4
+ data.tar.gz: da4973256fefbfe4677175d0c497f37ab76438ac00541af49cc871bd8cf3da63
5
5
  SHA512:
6
- metadata.gz: 4525044b21596dd6dc96d7aa397402421459ec483749df04dd08ad3f20de7a6a1998e38b9436d77522c48dedabb78a3b4e9e88ce2225e2c8633b8c32a30fa8a8
7
- data.tar.gz: 06d16a32919eb23b306add1ca5e1997694f0bbbb21d0bc045992530b2963cf65f6dbb987fb3223b50a1e543598e1f42611f17b80b206fb032d2c00d8ddb72eb9
6
+ metadata.gz: e943beb926810ae2e073ec19a7e619d6eb782c05fc54e0a9da5a643098b3d36fb066ab20e459bc12d27d8f93902cc9279772443ac22e31d41514e1274b7b597e
7
+ data.tar.gz: 9965599b55592b44969060284664179cc3e10d5a098eec598c42b775205a3c5f84e5309018665c0f6660063af6c698c2584dcf89c7303eeba8c85d9571676a89
data/README.md CHANGED
@@ -358,8 +358,9 @@ If you do not want inline editing of your list items but instead to fall back to
358
358
 
359
359
 
360
360
  # VERSION HISTORY
361
+ #### 2021-09-20 - v0.2.1 - Fixes nesting behavior when using gd option
361
362
 
362
- #### 2021-09-06 - v0.2.0 - SLIM and ERB ; use the option --markup=erb or --markup=haml (default is now erb)
363
+ #### 2021-09-06 - v0.2.0 - ERB or HAML; use the option --markup=erb or --markup=haml (default is now erb)
363
364
 
364
365
  #### 2021-06-28 - v0.1.2 - fixes problem with namespaces on path helpers
365
366
 
@@ -196,7 +196,7 @@ module HotGlue
196
196
  auth_assoc = @auth && @auth.gsub("current_","")
197
197
 
198
198
  if !@object_owner_sym.empty?
199
- auth_assoc_field = auth_assoc + "_id"
199
+ auth_assoc_field = auth_assoc + "_id" unless @god
200
200
  assoc = eval("#{singular_class}.reflect_on_association(:#{@object_owner_sym})")
201
201
 
202
202
  if assoc
@@ -431,7 +431,14 @@ module HotGlue
431
431
  end
432
432
 
433
433
  def new_path_name
434
- "new_#{@namespace+"_" if @namespace}#{singular}_path"
434
+
435
+ base = "new_#{@namespace+"_" if @namespace}#{(@nested_args.join("_") + "_") if @nested_args.any?}#{singular}_path"
436
+ if @nested_args.any?
437
+ base += "(" + @nested_args.collect { |arg|
438
+ "@#{arg}.id"
439
+ }.join(", ") + ")"
440
+
441
+ end
435
442
  end
436
443
 
437
444
  def nested_assignments
@@ -1,6 +1,11 @@
1
1
  class <%= controller_class_name %> < <%= controller_descends_from %>
2
2
  <% unless @auth_identifier == '' || @auth.nil? %>before_action :authenticate_<%= @auth_identifier %>!<% end %>
3
3
 
4
+ <% if any_nested? %><% nest_chain = [] %> <% @nested_args.each { |arg|
5
+ this_scope = nest_chain.empty? ? "#{@auth ? auth_object : class_name}.#{arg}s" : "#{nest_chain.last}.#{arg}s"
6
+ nest_chain << arg %>
7
+ before_action :<%= arg %>
8
+ <% } %><% end %>
4
9
  before_action :load_<%= singular_name %>, only: [:show, :edit, :update, :destroy]
5
10
  helper :hot_glue
6
11
  include HotGlue::ControllerHelper
@@ -9,9 +14,16 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
9
14
  # TODO: implement current_user or use Devise
10
15
  <% end %>
11
16
 
17
+
18
+
12
19
  <% if any_nested? %><% nest_chain = [] %> <% @nested_args.each { |arg|
13
- this_scope = nest_chain.empty? ? "#{@auth ? auth_object : class_name}.#{arg}s" : "#{nest_chain.last}.#{arg}s"
14
- nest_chain << arg %>
20
+ if !@god
21
+ this_scope = nest_chain.empty? ? "#{@auth ? auth_object : class_name}.#{arg}s" : "#{nest_chain.last}.#{arg}s"
22
+ else
23
+ this_scope = eval(class_name + ".reflect_on_association(:#{arg})").class_name
24
+ end
25
+ nest_chain << arg
26
+ %>
15
27
  def <%= arg %>
16
28
  @<%= arg %> ||= <%= this_scope %>.find(params[:<%= arg %>_id])
17
29
  end<% } %><% end %>
@@ -1,3 +1,3 @@
1
1
  module HotGlue
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hot-glue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Fleetwood-Boldt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-06 00:00:00.000000000 Z
11
+ date: 2021-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
200
  - !ruby/object:Gem::Version
201
201
  version: '0'
202
202
  requirements: []
203
- rubygems_version: 3.0.9
203
+ rubygems_version: 3.1.4
204
204
  signing_key:
205
205
  specification_version: 4
206
206
  summary: A gem build scaffolding.