hot-glue 0.6.29 → 0.6.31
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 +4 -4
 - data/Gemfile.lock +1 -1
 - data/README.md +120 -18
 - data/lib/generators/hot_glue/fields/association_field.rb +5 -3
 - data/lib/generators/hot_glue/fields/field.rb +6 -0
 - data/lib/generators/hot_glue/layout_strategy/bootstrap.rb +0 -1
 - data/lib/generators/hot_glue/scaffold_generator.rb +40 -9
 - data/lib/generators/hot_glue/templates/controller.rb.erb +8 -7
 - data/lib/hotglue/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: fd6bfe4a874a5e894d6b315e72c145f1a563ac3a851e2d4849e41eb127b4402f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: d88aeb4540484a0335150c0d637a8781b1781ff33b227cd65b60d96fa13703ac
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 16e4242488830bb7b4da394a9e6e919b32ef885ddf5ce506e05954ca5830b918a47b2662661289d0bf4adbb6b3e4bf5d89fdb2ddbb59f9333126622461fabb81
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9ac25352156d69caf694303602f968990441cded93504d6fc340df1b92091bb450f6372d409c10ba2be8a0599e1217e5d037e053b908c2b5136bad148f7719cb
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -558,22 +558,24 @@ The child object is named `Rule` but it can belong to a Blast or an Agent. (Agen 
     | 
|
| 
       558 
558 
     | 
    
         | 
| 
       559 
559 
     | 
    
         
             
            We build the blast & agent controllers like so:
         
     | 
| 
       560 
560 
     | 
    
         | 
| 
       561 
     | 
    
         
            -
             
     | 
| 
       562 
     | 
    
         
            -
            bin/rails generate hot_glue:scaffold  
     | 
| 
      
 561 
     | 
    
         
            +
             
     | 
| 
      
 562 
     | 
    
         
            +
            `bin/rails generate hot_glue:scaffold Blast  --downnest='blast_rules(rules)'`
         
     | 
| 
      
 563 
     | 
    
         
            +
             
     | 
| 
      
 564 
     | 
    
         
            +
            `bin/rails generate hot_glue:scaffold Agent  --downnest='agent_rules(rules)'`
         
     | 
| 
       563 
565 
     | 
    
         | 
| 
       564 
566 
     | 
    
         
             
            Notice that the relationship name is `rules` (not blast_rules), so what goes before the parenthesis is the controller name (with prefix)
         
     | 
| 
       565 
567 
     | 
    
         
             
            What goes inside the controller name is the real relationship name.
         
     | 
| 
       566 
568 
     | 
    
         | 
| 
       567 
569 
     | 
    
         
             
            For the children, we can't build one controller for the Rule, instead we build one for the `AgentRules` and another for the `BlastRules`
         
     | 
| 
       568 
570 
     | 
    
         | 
| 
       569 
     | 
    
         
            -
            bin/rails generate hot_glue:scaffold Rule  --nested='blast(ruleable)' --controller-prefix='Blast'
         
     | 
| 
       570 
     | 
    
         
            -
            bin/rails generate hot_glue:scaffold Rule  --nested='agent(ruleable)' --controller-prefix='Agent'
         
     | 
| 
      
 571 
     | 
    
         
            +
            `bin/rails generate hot_glue:scaffold Rule  --nested='blast(ruleable)' --controller-prefix='Blast'`
         
     | 
| 
      
 572 
     | 
    
         
            +
            `bin/rails generate hot_glue:scaffold Rule  --nested='agent(ruleable)' --controller-prefix='Agent'`
         
     | 
| 
       571 
573 
     | 
    
         | 
| 
       572 
574 
     | 
    
         
             
            (I realize building one child controller for each type of polymorph is tedius, but this is the best solution I could come up with.)
         
     | 
| 
       573 
575 
     | 
    
         | 
| 
       574 
576 
     | 
    
         
             
            As these are children, what goes into the `--netsed` setting inside the parentheses is the polymorphic name specified by `as:` when declaring the `belongs_to`
         
     | 
| 
       575 
577 
     | 
    
         | 
| 
       576 
     | 
    
         
            -
            routes.rb
         
     | 
| 
      
 578 
     | 
    
         
            +
            config/routes.rb
         
     | 
| 
       577 
579 
     | 
    
         | 
| 
       578 
580 
     | 
    
         
             
            ```
         
     | 
| 
       579 
581 
     | 
    
         
             
                    resources :agents do
         
     | 
| 
         @@ -585,6 +587,22 @@ routes.rb 
     | 
|
| 
       585 
587 
     | 
    
         
             
                    end
         
     | 
| 
       586 
588 
     | 
    
         
             
            ```
         
     | 
| 
       587 
589 
     | 
    
         | 
| 
      
 590 
     | 
    
         
            +
            Outside a polymorphic relationship, you sometimes have children with `belongs_to` that uses a custom name instead of the name of the class (using class_name on the belongs to)
         
     | 
| 
      
 591 
     | 
    
         
            +
             
     | 
| 
      
 592 
     | 
    
         
            +
            Imagine a `followings` table with two foreign keys: follower_id and follows_id (both pointing to a BskyUser)
         
     | 
| 
      
 593 
     | 
    
         
            +
             
     | 
| 
      
 594 
     | 
    
         
            +
             
     | 
| 
      
 595 
     | 
    
         
            +
            `belongs_to :follower, class_name: "BskyUser", foreign_key: :follower_id`
         
     | 
| 
      
 596 
     | 
    
         
            +
            `belongs_to :follows, class_name: "BskyUser", foreign_key: :follows_id`
         
     | 
| 
      
 597 
     | 
    
         
            +
             
     | 
| 
      
 598 
     | 
    
         
            +
             
     | 
| 
      
 599 
     | 
    
         
            +
            Here, specify nested using square braces for the non-standard parent name
         
     | 
| 
      
 600 
     | 
    
         
            +
             
     | 
| 
      
 601 
     | 
    
         
            +
            `--nested='bsky_users[follower]'` and `--nested='bsky_users[follows]'`
         
     | 
| 
      
 602 
     | 
    
         
            +
             
     | 
| 
      
 603 
     | 
    
         
            +
             
     | 
| 
      
 604 
     | 
    
         
            +
             
     | 
| 
      
 605 
     | 
    
         
            +
             
     | 
| 
       588 
606 
     | 
    
         
             
            ### `--stacked-downnesting`
         
     | 
| 
       589 
607 
     | 
    
         | 
| 
       590 
608 
     | 
    
         
             
            This puts the downnested portals on top of one another (stacked top to bottom) instead of side-by-side (left to right). This is useful if you have a lot of downnested portals and you want to keep the page from getting too wide.
         
     | 
| 
         @@ -1068,9 +1086,11 @@ Here, the `cost` and `price` fields will be displayed as wrapped in `number_to_c 
     | 
|
| 
       1068 
1086 
     | 
    
         
             
            You can also use a binary modifier, which can apply to booleans, datetimes, times, dates or anything else. When using the binary modify, a specific value is displayed if the field is truthy and another one is display if the field is falsy.
         
     | 
| 
       1069 
1087 
     | 
    
         
             
            You specify it using a pipe | character like so:
         
     | 
| 
       1070 
1088 
     | 
    
         | 
| 
      
 1089 
     | 
    
         
            +
            Example binary modification: 
         
     | 
| 
      
 1090 
     | 
    
         
            +
             
     | 
| 
       1071 
1091 
     | 
    
         
             
            `--modify=paid_at{paid|unpaid}`
         
     | 
| 
       1072 
1092 
     | 
    
         | 
| 
       1073 
     | 
    
         
            -
             
     | 
| 
      
 1093 
     | 
    
         
            +
            Here, even though `paid_at` is a datetime field, it will display as-if it is a binary -- showing either the truthy 
         
     | 
| 
       1074 
1094 
     | 
    
         
             
            label or the falsy label depending on if `paid_at` is or is not null in the database.  
         
     | 
| 
       1075 
1095 
     | 
    
         
             
            For all fields except booleans, this affects only the viewable output — 
         
     | 
| 
       1076 
1096 
     | 
    
         
             
            what you see on the list page and on the edit page for show-only fields.  
         
     | 
| 
         @@ -1081,20 +1101,25 @@ You will need to separately specify them as show-only if you want them to be non 
     | 
|
| 
       1081 
1101 
     | 
    
         | 
| 
       1082 
1102 
     | 
    
         
             
            Notice that each modifiers can be used with specific field types. 
         
     | 
| 
       1083 
1103 
     | 
    
         | 
| 
       1084 
     | 
    
         
            -
            | user modifier                 | what it does                                                                                                                                                         | Field types                       |   | 
     | 
| 
       1085 
     | 
    
         
            -
             
     | 
| 
       1086 
     | 
    
         
            -
            | $                             | wraps output in `number_to_currency()`                                                                                                                               | floats and integers               |   | 
     | 
| 
      
 1104 
     | 
    
         
            +
            | user modifier                 | what it does                                                                                                                                                         | Field types                       |   |    |
         
     | 
| 
      
 1105 
     | 
    
         
            +
            |-------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|---|----|
         
     | 
| 
      
 1106 
     | 
    
         
            +
            | $                             | wraps output in `number_to_currency()`                                                                                                                               | floats and integers               |   |    |
         
     | 
| 
       1087 
1107 
     | 
    
         
             
            | (truthy label)\|(falsy label) | specify a binary switch with a pipe (\|) character if the value is truthy, it will display as "truthy label" if the value is falsy, it will display as "falsy label" | booleans, datetimes, dates, times |   |    |
         
     | 
| 
       1088 
     | 
    
         
            -
            | partials                      | applies to enums only, you must have a partial whose name matches each enum type                                                                                     | enums only                        |   | 
     | 
| 
       1089 
     | 
    
         
            -
            | tinymce                       | applies to text fields only, be sure to setup TineMCE globally                                                                                                       | text fields only                  |    | 
     | 
| 
       1090 
     | 
    
         
            -
            | typeahead                     | turns a foreign key (only) into a searchable typeahead field                                                                                                         | foreign keys only                 |   | 
     | 
| 
       1091 
     | 
    
         
            -
            | timezone                      | turns a string (varchar) into a drop down of timezones                                                                                                               | foreign keys only                 |   | 
     | 
| 
       1092 
     | 
    
         
            -
            | include_blank                 | special modifier for association fields, adds include_blank to the created dropdown 
     | 
| 
      
 1108 
     | 
    
         
            +
            | partials                      | applies to enums only, you must have a partial whose name matches each enum type                                                                                     | enums only                        |   |    |
         
     | 
| 
      
 1109 
     | 
    
         
            +
            | tinymce                       | applies to text fields only, be sure to setup TineMCE globally                                                                                                       | text fields only                  |   |    |
         
     | 
| 
      
 1110 
     | 
    
         
            +
            | typeahead                     | turns a foreign key (only) into a searchable typeahead field                                                                                                         | foreign keys only                 |   |    |
         
     | 
| 
      
 1111 
     | 
    
         
            +
            | timezone                      | turns a string (varchar) into a drop down of timezones                                                                                                               | foreign keys only                 |   |    |
         
     | 
| 
      
 1112 
     | 
    
         
            +
            | include_blank                 | special modifier for association fields, adds include_blank to the created dropdown                                                                                  |                                   |
         
     | 
| 
      
 1113 
     | 
    
         
            +
            | urlwrap                       | wrap this field in a URL                                                                                                                                             | any printable field               |   |    |
         
     | 
| 
       1093 
1114 
     | 
    
         
             
            | none                          | special modifier for using badges                                                                                                                                    |
         
     | 
| 
       1094 
1115 
     | 
    
         | 
| 
       1095 
1116 
     | 
    
         
             
            Except for "(truthy label)" and "(falsy label)" which use the special syntax, use the modifier _exactly_ as it is named.
         
     | 
| 
       1096 
1117 
     | 
    
         | 
| 
       1097 
     | 
    
         
            -
             
     | 
| 
      
 1118 
     | 
    
         
            +
            Some modifiers take a 3rd parameter in `[` and `]` markers after the modification marker. The 3rd parameters function depends on which modifier you are using. 
         
     | 
| 
      
 1119 
     | 
    
         
            +
             
     | 
| 
      
 1120 
     | 
    
         
            +
             
     | 
| 
      
 1121 
     | 
    
         
            +
            #### Binary (use | to separate "true value" from "false value")
         
     | 
| 
      
 1122 
     | 
    
         
            +
            Can take a bootstrap badge name as 3rd parameter
         
     | 
| 
       1098 
1123 
     | 
    
         | 
| 
       1099 
1124 
     | 
    
         
             
            `--modify=opened_at{opened|closed}[bg-primary|bg-secondary]`
         
     | 
| 
       1100 
1125 
     | 
    
         
             
            Applies a badge `bg-primary` to rows with opened_at truthy and `bg-secondary` to rows with opened_at falsy.
         
     | 
| 
         @@ -1102,10 +1127,50 @@ Applies a badge `bg-primary` to rows with opened_at truthy and `bg-secondary` to 
     | 
|
| 
       1102 
1127 
     | 
    
         
             
            to display a badge on everything, use the `none` modifier with the
         
     | 
| 
       1103 
1128 
     | 
    
         
             
            `--modify=opened_at{none}[bg-dark]`
         
     | 
| 
       1104 
1129 
     | 
    
         | 
| 
      
 1130 
     | 
    
         
            +
            #### $
         
     | 
| 
       1105 
1131 
     | 
    
         
             
            For the `$` modifier only, if the field name ends with `_cents`, the modifier will automatically divide the field by 100 before displaying it.
         
     | 
| 
       1106 
     | 
    
         
            -
             
     | 
| 
       1107 
1132 
     | 
    
         
             
            (This is consistent with Stripe'e paradigm to always store money in cents, and this way I force myself to put `_cents` on the end of my field names to remind myself that they are in cents.)
         
     | 
| 
       1108 
1133 
     | 
    
         | 
| 
      
 1134 
     | 
    
         
            +
             
     | 
| 
      
 1135 
     | 
    
         
            +
            #### Typeahead
         
     | 
| 
      
 1136 
     | 
    
         
            +
            3rd parameter (in `[...]`) used to specify the nested set IF the typeahead itself is nested (optional)
         
     | 
| 
      
 1137 
     | 
    
         
            +
            - see the typeahead section for details
         
     | 
| 
      
 1138 
     | 
    
         
            +
             
     | 
| 
      
 1139 
     | 
    
         
            +
            #### urlwrap
         
     | 
| 
      
 1140 
     | 
    
         
            +
             
     | 
| 
      
 1141 
     | 
    
         
            +
            Use to wrap the field contents in a clickable link.
         
     | 
| 
      
 1142 
     | 
    
         
            +
             
     | 
| 
      
 1143 
     | 
    
         
            +
            `rails generate hot_glue:scaffold BskyUser --gd --modify='handle{urlwrap}[bsky_url]'`
         
     | 
| 
      
 1144 
     | 
    
         
            +
             
     | 
| 
      
 1145 
     | 
    
         
            +
            Here, we are telling Hot Glue that we want to modify the field called `handle` to be wrapped in a URL.
         
     | 
| 
      
 1146 
     | 
    
         
            +
            We form that URL but calling the helper method `bsky_url` (must be defined in your helpers)
         
     | 
| 
      
 1147 
     | 
    
         
            +
             
     | 
| 
      
 1148 
     | 
    
         
            +
            When we do make that call, notice that we pass two arguments to bsky_url (not seen):
         
     | 
| 
      
 1149 
     | 
    
         
            +
            1) the field we are modifying
         
     | 
| 
      
 1150 
     | 
    
         
            +
            2) the object
         
     | 
| 
      
 1151 
     | 
    
         
            +
             
     | 
| 
      
 1152 
     | 
    
         
            +
             
     | 
| 
      
 1153 
     | 
    
         
            +
            `bsky_url(bsky_user.handle, bsky_user)`
         
     | 
| 
      
 1154 
     | 
    
         
            +
             
     | 
| 
      
 1155 
     | 
    
         
            +
            (`bsky_user.handle` is the field to be modified, what will become the link text. `bsky_user` is the instance of the model
         
     | 
| 
      
 1156 
     | 
    
         
            +
            object as it is displayed to the screen)
         
     | 
| 
      
 1157 
     | 
    
         
            +
             
     | 
| 
      
 1158 
     | 
    
         
            +
            its implementation might look like this:
         
     | 
| 
      
 1159 
     | 
    
         
            +
             
     | 
| 
      
 1160 
     | 
    
         
            +
            ```
         
     | 
| 
      
 1161 
     | 
    
         
            +
            module BskyUserHelper
         
     | 
| 
      
 1162 
     | 
    
         
            +
             
     | 
| 
      
 1163 
     | 
    
         
            +
              def bsky_url(link_text, bsky_user)
         
     | 
| 
      
 1164 
     | 
    
         
            +
                link_to link_text, "https://#{bsky_user.handle}", target: "_blank"
         
     | 
| 
      
 1165 
     | 
    
         
            +
              end
         
     | 
| 
      
 1166 
     | 
    
         
            +
            end
         
     | 
| 
      
 1167 
     | 
    
         
            +
            ```
         
     | 
| 
      
 1168 
     | 
    
         
            +
            In this case I happen to be turning piece of text _that is the link itself_ into a link,
         
     | 
| 
      
 1169 
     | 
    
         
            +
            which is why you see `"https://#{bsky_user.handle}"` in the URL being generated, but this is arbitrary.
         
     | 
| 
      
 1170 
     | 
    
         
            +
            You can make any piece of text into a link, the helper method is only used to construct the link.
         
     | 
| 
      
 1171 
     | 
    
         
            +
             
     | 
| 
      
 1172 
     | 
    
         
            +
             
     | 
| 
      
 1173 
     | 
    
         
            +
             
     | 
| 
       1109 
1174 
     | 
    
         
             
            ### `--alt-foreign-key-lookup=`
         
     | 
| 
       1110 
1175 
     | 
    
         | 
| 
       1111 
1176 
     | 
    
         
             
            Use for a join table to specify that a field should be looked up by a different field. For example, when you want to lookup a user by a (complete) email address.
         
     | 
| 
         @@ -2161,7 +2226,29 @@ This means that to find users within the search, the essential piece of informat 
     | 
|
| 
       2161 
2226 
     | 
    
         
             
              end
         
     | 
| 
       2162 
2227 
     | 
    
         
             
            ```
         
     | 
| 
       2163 
2228 
     | 
    
         | 
| 
      
 2229 
     | 
    
         
            +
            If you want your typeahead to accept an input for a non-matched field, you need to use a factory (see `--factory-creation`)
         
     | 
| 
       2164 
2230 
     | 
    
         | 
| 
      
 2231 
     | 
    
         
            +
            Here, we assume that Authors are nested within a library (an arbitrary abstraction to demonstrate a typeahead at a nested route)
         
     | 
| 
      
 2232 
     | 
    
         
            +
             
     | 
| 
      
 2233 
     | 
    
         
            +
            ```
         
     | 
| 
      
 2234 
     | 
    
         
            +
                  factory = AuthorsFactory.new(
         
     | 
| 
      
 2235 
     | 
    
         
            +
                    library: library,
         
     | 
| 
      
 2236 
     | 
    
         
            +
                    query: params[:authors_query],
         
     | 
| 
      
 2237 
     | 
    
         
            +
                    author_params: modified_params)
         
     | 
| 
      
 2238 
     | 
    
         
            +
            ```
         
     | 
| 
      
 2239 
     | 
    
         
            +
             
     | 
| 
      
 2240 
     | 
    
         
            +
            Your authors factory will need to check the params for `author_params[:author_id].empty?`
         
     | 
| 
      
 2241 
     | 
    
         
            +
             
     | 
| 
      
 2242 
     | 
    
         
            +
             
     | 
| 
      
 2243 
     | 
    
         
            +
            When the factory is passed an empty string here, it is from a non-matched lookup. You will either lookup the author_id if provided, or create a new one if not
         
     | 
| 
      
 2244 
     | 
    
         
            +
            ```
         
     | 
| 
      
 2245 
     | 
    
         
            +
                  if !author_params[:author_id].empty?
         
     | 
| 
      
 2246 
     | 
    
         
            +
                    author = Author.find(author_params[:author_id])
         
     | 
| 
      
 2247 
     | 
    
         
            +
                  else
         
     | 
| 
      
 2248 
     | 
    
         
            +
                    author = Target.find_or_create_by!(library: library,  name: query)
         
     | 
| 
      
 2249 
     | 
    
         
            +
                  end
         
     | 
| 
      
 2250 
     | 
    
         
            +
            ```
         
     | 
| 
      
 2251 
     | 
    
         
            +
            Notice this is creating a new author by the `name` field, which should be same field you are searching by in the typeahead.
         
     | 
| 
       2165 
2252 
     | 
    
         | 
| 
       2166 
2253 
     | 
    
         
             
            --
         
     | 
| 
       2167 
2254 
     | 
    
         | 
| 
         @@ -2244,13 +2331,28 @@ These automatic pickups for partials are detected at build time. This means that 
     | 
|
| 
       2244 
2331 
     | 
    
         | 
| 
       2245 
2332 
     | 
    
         
             
            # VERSION HISTORY
         
     | 
| 
       2246 
2333 
     | 
    
         | 
| 
       2247 
     | 
    
         
            -
            #### 2025-10- 
     | 
| 
      
 2334 
     | 
    
         
            +
            #### 2025-10-28 - v0.6.31
         
     | 
| 
      
 2335 
     | 
    
         
            +
             
     | 
| 
      
 2336 
     | 
    
         
            +
            - new modification directive: `urlwrap`: use to wrap the field contents in a clickable link.
         
     | 
| 
      
 2337 
     | 
    
         
            +
            See docs for "urlwrap" in the `--modify=` section above
         
     | 
| 
      
 2338 
     | 
    
         
            +
             
     | 
| 
      
 2339 
     | 
    
         
            +
            - Fixes for typeaheads: corrects search url when the typeahead is built against a two-word model name
         
     | 
| 
      
 2340 
     | 
    
         
            +
             
     | 
| 
      
 2341 
     | 
    
         
            +
            - Fixes for source reflection on has_many associations
         
     | 
| 
      
 2342 
     | 
    
         
            +
             
     | 
| 
      
 2343 
     | 
    
         
            +
            #### 2025-10-19 - v0.6.30
         
     | 
| 
      
 2344 
     | 
    
         
            +
            - fixes references from search typeaheads to a typeahead controller which is nested
         
     | 
| 
      
 2345 
     | 
    
         
            +
            - `--nested` can now take square braces if the relationship from child to parent (belongs_to) uses a non-standard association name; @downnest_object fix for data array; changes to object_scope to accomodate new paradigm
         
     | 
| 
      
 2346 
     | 
    
         
            +
             
     | 
| 
      
 2347 
     | 
    
         
            +
             
     | 
| 
      
 2348 
     | 
    
         
            +
             
     | 
| 
      
 2349 
     | 
    
         
            +
            #### 2025-10-11 - v0.6.29
         
     | 
| 
       2248 
2350 
     | 
    
         | 
| 
       2249 
2351 
     | 
    
         
             
            • When specifying  a alt lookup in non-Gd mode, we treat this a security concern because alt lookups can get any related record from the database; if you use a factory when creating your object, you can pass the lookup to the factory and scope your lookup in there; fix to not raise exception when specified an alt lookup in non-Gd mode if you are also using a factory
         
     | 
| 
       2250 
2352 
     | 
    
         | 
| 
       2251 
2353 
     | 
    
         
             
            • Attachments now have a graceful fail if the attachment is invariable (cannot be made into a thumbnail), and so there is no thumbnail to display. Instead, a small box with the file type ("pdf" or "msword") is shown in place where the thumbnail would display
         
     | 
| 
       2252 
2354 
     | 
    
         | 
| 
       2253 
     | 
    
         
            -
            • Adds a ' 
     | 
| 
      
 2355 
     | 
    
         
            +
            • Adds a 'triple' implementation for newer pagination gems: will_paginate and pagy. HG will auto detect which pagination gem you have in your Gemfile, and pick ONE of the three based on this preference order: Pagy over will_paginate; will_paginate over Kaminari, no pagination if none of the three are installed.
         
     | 
| 
       2254 
2356 
     | 
    
         | 
| 
       2255 
2357 
     | 
    
         
             
            Kaminari is barely workable with newer Rails and seems somewhat abandoned; will_paginate is officially in maintenance mode, so Pagy is the way to go. I have implemented all three for the widest legacy support. On my Rails Cookbook pages, I have replaced Kaminari with Pagy.
         
     | 
| 
       2256 
2358 
     | 
    
         | 
| 
         @@ -103,8 +103,7 @@ class AssociationField < Field 
     | 
|
| 
       103 
103 
     | 
    
         | 
| 
       104 
104 
     | 
    
         
             
                  search_url  = "#{namespace ? namespace + "_" : ""}" +
         
     | 
| 
       105 
105 
     | 
    
         
             
                    modify_as[:nested].join("_") + ( modify_as[:nested].any? ? "_" : "") +
         
     | 
| 
       106 
     | 
    
         
            -
                    + "#{assoc. 
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
      
 106 
     | 
    
         
            +
                    + "#{assoc.name.to_s.pluralize}_typeahead_index_url"
         
     | 
| 
       108 
107 
     | 
    
         | 
| 
       109 
108 
     | 
    
         
             
                  if @modify_as[:nested].any?
         
     | 
| 
       110 
109 
     | 
    
         
             
                    search_url  << "(" + modify_as[:nested].collect{|x| "#{x}"}.join(",") + ")"
         
     | 
| 
         @@ -204,7 +203,10 @@ class AssociationField < Field 
     | 
|
| 
       204 
203 
     | 
    
         
             
                assoc_name = name.to_s.gsub("_id","")
         
     | 
| 
       205 
204 
     | 
    
         
             
                assoc = eval("#{class_name}.reflect_on_association(:#{assoc_name})")
         
     | 
| 
       206 
205 
     | 
    
         
             
                if modify_as && modify_as[:typeahead]
         
     | 
| 
       207 
     | 
    
         
            -
             
     | 
| 
      
 206 
     | 
    
         
            +
             
     | 
| 
      
 207 
     | 
    
         
            +
             
     | 
| 
      
 208 
     | 
    
         
            +
                  search_url  = "#{namespace ? namespace + "_" : ""}#{ modify_as[:nested][0] ? modify_as[:nested][0] + "_" : ""}#{assoc.name.to_s.pluralize}_typeahead_index_url"
         
     | 
| 
      
 209 
     | 
    
         
            +
             
     | 
| 
       208 
210 
     | 
    
         | 
| 
       209 
211 
     | 
    
         
             
                  # \"q[0][#{name}_search]\"
         
     | 
| 
       210 
212 
     | 
    
         
             
                  # @q['0']['#{name}_search']
         
     | 
| 
         @@ -146,7 +146,13 @@ class Field 
     | 
|
| 
       146 
146 
     | 
    
         | 
| 
       147 
147 
     | 
    
         
             
                elsif modify_as[:timezone]
         
     | 
| 
       148 
148 
     | 
    
         
             
                  res += "<%= #{singular}.#{name} %>"
         
     | 
| 
      
 149 
     | 
    
         
            +
                elsif modify_as[:urlwrap]
         
     | 
| 
      
 150 
     | 
    
         
            +
                  # helper_method =  modify_as[:helper_method].split(" ")[0]
         
     | 
| 
      
 151 
     | 
    
         
            +
                  # param = modify_as[:helper_method].split(" ")[1]
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
                  res += "<%= #{modify_as[:helper_method]}(#{singular}.#{name}, #{singular})  %>"
         
     | 
| 
       149 
154 
     | 
    
         
             
                elsif modify_as[:enum]
         
     | 
| 
      
 155 
     | 
    
         
            +
             
     | 
| 
       150 
156 
     | 
    
         
             
                elsif modify_as[:none]
         
     | 
| 
       151 
157 
     | 
    
         
             
                    field_view_output
         
     | 
| 
       152 
158 
     | 
    
         
             
                  # res += "<%= render partial: #{singular}.#{name}, locals: {#{singular}: #{singular}} %>"
         
     | 
| 
         @@ -300,6 +300,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator 
     | 
|
| 
       300 
300 
     | 
    
         
             
                      setting =~ /(.*){(.*)}/
         
     | 
| 
       301 
301 
     | 
    
         
             
                      key, lookup_as = $1, $2
         
     | 
| 
       302 
302 
     | 
    
         
             
                    end
         
     | 
| 
      
 303 
     | 
    
         
            +
             
     | 
| 
       303 
304 
     | 
    
         
             
                    if ["$"].include?($2)
         
     | 
| 
       304 
305 
     | 
    
         
             
                      @modify_as[key.to_sym] =  {cast: $2, badges: $3}
         
     | 
| 
       305 
306 
     | 
    
         
             
                    elsif $2.include?("|")
         
     | 
| 
         @@ -322,6 +323,10 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator 
     | 
|
| 
       322 
323 
     | 
    
         
             
                      @modify_as[key.to_sym] =  {timezone: 1, badges: $3}
         
     | 
| 
       323 
324 
     | 
    
         
             
                    elsif $2 == "include_blank"
         
     | 
| 
       324 
325 
     | 
    
         
             
                      @modify_as[key.to_sym] =  {include_blank: true}
         
     | 
| 
      
 326 
     | 
    
         
            +
                    elsif $2 == "urlwrap"
         
     | 
| 
      
 327 
     | 
    
         
            +
                      helper_method = $3
         
     | 
| 
      
 328 
     | 
    
         
            +
                      @modify_as[key.to_sym] = { urlwrap: true,
         
     | 
| 
      
 329 
     | 
    
         
            +
                                                 helper_method: helper_method }
         
     | 
| 
       325 
330 
     | 
    
         
             
                    elsif $2 == "none"
         
     | 
| 
       326 
331 
     | 
    
         
             
                      @modify_as[key.to_sym] =  {none: 1, badges: $3}
         
     | 
| 
       327 
332 
     | 
    
         
             
                    else
         
     | 
| 
         @@ -456,11 +461,10 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator 
     | 
|
| 
       456 
461 
     | 
    
         | 
| 
       457 
462 
     | 
    
         
             
                    child_name.gsub!("+","")
         
     | 
| 
       458 
463 
     | 
    
         | 
| 
       459 
     | 
    
         
            -
             
     | 
| 
       460 
     | 
    
         
            -
                    @downnest_object[child] = {
         
     | 
| 
      
 464 
     | 
    
         
            +
                    @downnest_object[child_name] = {
         
     | 
| 
       461 
465 
     | 
    
         
             
                      name: child_name,
         
     | 
| 
       462 
466 
     | 
    
         
             
                      extra_size: extra_size,
         
     | 
| 
       463 
     | 
    
         
            -
                      polymorph_as: polymorph_as
         
     | 
| 
      
 467 
     | 
    
         
            +
                      polymorph_as: polymorph_as,
         
     | 
| 
       464 
468 
     | 
    
         
             
                    }
         
     | 
| 
       465 
469 
     | 
    
         
             
                  end
         
     | 
| 
       466 
470 
     | 
    
         
             
                end
         
     | 
| 
         @@ -512,17 +516,27 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator 
     | 
|
| 
       512 
516 
     | 
    
         | 
| 
       513 
517 
     | 
    
         
             
                if !@nested.nil?
         
     | 
| 
       514 
518 
     | 
    
         
             
                  @nested_set = @nested.split("/").collect { |arg|
         
     | 
| 
       515 
     | 
    
         
            -
                    if arg.include?("(")
         
     | 
| 
      
 519 
     | 
    
         
            +
                    if arg.include?("[") && arg.include?("(")
         
     | 
| 
      
 520 
     | 
    
         
            +
                      arg =~ /(.*)\((.*)\)\[(.*)\]/
         
     | 
| 
      
 521 
     | 
    
         
            +
                      singular, polymorph_as, parent_name = $1, $2, $3
         
     | 
| 
      
 522 
     | 
    
         
            +
             
     | 
| 
      
 523 
     | 
    
         
            +
                    elsif arg.include?("(")
         
     | 
| 
       516 
524 
     | 
    
         
             
                      arg =~ /(.*)\((.*)\)/
         
     | 
| 
       517 
525 
     | 
    
         
             
                      singular, polymorph_as = $1, $2
         
     | 
| 
      
 526 
     | 
    
         
            +
                      parent_name = singular
         
     | 
| 
      
 527 
     | 
    
         
            +
                    elsif arg.include?("[")
         
     | 
| 
      
 528 
     | 
    
         
            +
                      arg =~ /(.*)\[(.*)\]/
         
     | 
| 
      
 529 
     | 
    
         
            +
                      singular, parent_name = $1, $2
         
     | 
| 
       518 
530 
     | 
    
         
             
                    else
         
     | 
| 
       519 
531 
     | 
    
         
             
                      singular = arg
         
     | 
| 
      
 532 
     | 
    
         
            +
                      parent_name = singular
         
     | 
| 
       520 
533 
     | 
    
         
             
                    end
         
     | 
| 
       521 
534 
     | 
    
         | 
| 
       522 
535 
     | 
    
         
             
                    {
         
     | 
| 
       523 
536 
     | 
    
         
             
                      singular: singular,
         
     | 
| 
       524 
537 
     | 
    
         
             
                      plural: singular.pluralize,
         
     | 
| 
       525 
     | 
    
         
            -
                      polymorph_as: polymorph_as
         
     | 
| 
      
 538 
     | 
    
         
            +
                      polymorph_as: polymorph_as,
         
     | 
| 
      
 539 
     | 
    
         
            +
                      parent_name: parent_name
         
     | 
| 
       526 
540 
     | 
    
         
             
                    }
         
     | 
| 
       527 
541 
     | 
    
         
             
                  }
         
     | 
| 
       528 
542 
     | 
    
         
             
                  puts "NESTING: #{@nested_set}"
         
     | 
| 
         @@ -1426,17 +1440,34 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator 
     | 
|
| 
       1426 
1440 
     | 
    
         
             
              end
         
     | 
| 
       1427 
1441 
     | 
    
         | 
| 
       1428 
1442 
     | 
    
         
             
              def object_scope
         
     | 
| 
      
 1443 
     | 
    
         
            +
                if @nested_set.any? && @nested_set.last[:parent_name]
         
     | 
| 
      
 1444 
     | 
    
         
            +
                  last_parent = @nested_set.last[:parent_name]
         
     | 
| 
      
 1445 
     | 
    
         
            +
                  foreign_key =  eval("#{singular_class}.reflect_on_association(:#{last_parent})").foreign_key
         
     | 
| 
      
 1446 
     | 
    
         
            +
                  association = eval(singular_class).reflect_on_association(@nested_set.last[:parent_name].to_sym)
         
     | 
| 
      
 1447 
     | 
    
         
            +
                                                    .klass.reflect_on_all_associations(:has_many)
         
     | 
| 
      
 1448 
     | 
    
         
            +
                                                    .to_a.find{|x|
         
     | 
| 
      
 1449 
     | 
    
         
            +
             
     | 
| 
      
 1450 
     | 
    
         
            +
                      if x.source_reflection
         
     | 
| 
      
 1451 
     | 
    
         
            +
                        x.table_name == plural
         
     | 
| 
      
 1452 
     | 
    
         
            +
                      end
         
     | 
| 
      
 1453 
     | 
    
         
            +
                  }.plural_name
         
     | 
| 
      
 1454 
     | 
    
         
            +
             
     | 
| 
      
 1455 
     | 
    
         
            +
                else
         
     | 
| 
      
 1456 
     | 
    
         
            +
                  association = plural
         
     | 
| 
      
 1457 
     | 
    
         
            +
                end
         
     | 
| 
      
 1458 
     | 
    
         
            +
             
     | 
| 
      
 1459 
     | 
    
         
            +
             
     | 
| 
       1429 
1460 
     | 
    
         
             
                if @auth && !@god
         
     | 
| 
       1430 
1461 
     | 
    
         
             
                  if @nested_set.none?
         
     | 
| 
       1431 
     | 
    
         
            -
                    @auth + ".#{ 
     | 
| 
      
 1462 
     | 
    
         
            +
                    @auth + ".#{association}"
         
     | 
| 
       1432 
1463 
     | 
    
         
             
                  else
         
     | 
| 
       1433 
     | 
    
         
            -
                    "@" + @nested_set.last[:singular] + ".#{ 
     | 
| 
      
 1464 
     | 
    
         
            +
                    "@" + @nested_set.last[:singular] + ".#{association}"
         
     | 
| 
       1434 
1465 
     | 
    
         
             
                  end
         
     | 
| 
       1435 
1466 
     | 
    
         
             
                else
         
     | 
| 
       1436 
1467 
     | 
    
         
             
                  if @nested_set.none?
         
     | 
| 
       1437 
1468 
     | 
    
         
             
                    @singular_class
         
     | 
| 
       1438 
1469 
     | 
    
         
             
                  else
         
     | 
| 
       1439 
     | 
    
         
            -
                    "@" + @nested_set.last[:singular] + ".#{ 
     | 
| 
      
 1470 
     | 
    
         
            +
                    "@" + @nested_set.last[:singular] + ".#{association}"
         
     | 
| 
       1440 
1471 
     | 
    
         
             
                  end
         
     | 
| 
       1441 
1472 
     | 
    
         
             
                end
         
     | 
| 
       1442 
1473 
     | 
    
         
             
              end
         
     | 
| 
         @@ -1825,7 +1856,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator 
     | 
|
| 
       1825 
1856 
     | 
    
         
             
                else
         
     | 
| 
       1826 
1857 
     | 
    
         
             
                  if !@self_auth
         
     | 
| 
       1827 
1858 
     | 
    
         | 
| 
       1828 
     | 
    
         
            -
                    res << spaces(4) + "@#{ plural_name } = #{ object_scope.gsub("@",'') }#{ n_plus_one_includes }#{ 
     | 
| 
      
 1859 
     | 
    
         
            +
                    res << spaces(4) + "@#{ plural_name } = #{ object_scope.gsub("@",'') }#{record_scope}#{ n_plus_one_includes }#{".all" if n_plus_one_includes.blank? && record_scope.blank? }"
         
     | 
| 
       1829 
1860 
     | 
    
         | 
| 
       1830 
1861 
     | 
    
         
             
                    if @search_fields
         
     | 
| 
       1831 
1862 
     | 
    
         
             
                      res << @search_fields.collect{ |field|
         
     | 
| 
         @@ -24,15 +24,15 @@ class <%= controller_class_name %> < <%= controller_descends_from %> 
     | 
|
| 
       24 
24 
     | 
    
         
             
              before_action :<%= arg[:singular] %><%= ", if: -> { params.include?(:#{arg[:singular]}_id) }" if arg[:optional] %><% } %><% end %>
         
     | 
| 
       25 
25 
     | 
    
         
             
              before_action :load_<%= singular_name %>, only: %i[<%= "show edit update" unless @no_edit %> <%= "destroy" unless @no_delete %>]
         
     | 
| 
       26 
26 
     | 
    
         
             
              after_action -> { flash.discard }, if: -> { request.format.symbol == :turbo_stream }<% if @nested_set.any? %>
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              def <%= @nested_set[0][:singular] %><% if @god
         
     | 
| 
       28 
29 
     | 
    
         
             
                   next_object = nil
         
     | 
| 
       29 
30 
     | 
    
         
             
                   collect_objects = @nested_set.reverse.collect {|x|
         
     | 
| 
       30 
     | 
    
         
            -
                        
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                        
     | 
| 
       33 
     | 
    
         
            -
                       # if  eval("#{next_object || class_name}.reflect_on_association(:#{x[:singular]})")
         
     | 
| 
       34 
     | 
    
         
            -
                       next_object = eval("#{next_object || class_name}.reflect_on_association(:#{x[:singular]})").class_name
         
     | 
| 
      
 31 
     | 
    
         
            +
                       assoc_name = x[:parent_name] || x[:singular]
         
     | 
| 
      
 32 
     | 
    
         
            +
                       # if eval("#{next_object || class_name}.reflect_on_association(:#{assoc_name})").nil?
         
     | 
| 
      
 33 
     | 
    
         
            +
                       #   raise "***** Unable to find the association `#{assoc_name}` on the class #{next_object || class_name} ..... you probably want to add `belongs_to :#{assoc_name}` to the #{next_object || class_name} object?"
         
     | 
| 
       35 
34 
     | 
    
         
             
                       # end
         
     | 
| 
      
 35 
     | 
    
         
            +
                       next_object = eval("#{next_object || class_name}.reflect_on_association(:#{assoc_name})").class_name
         
     | 
| 
       36 
36 
     | 
    
         
             
                   }
         
     | 
| 
       37 
37 
     | 
    
         
             
                   root_object = collect_objects.last
         
     | 
| 
       38 
38 
     | 
    
         
             
                 else
         
     | 
| 
         @@ -42,6 +42,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %> 
     | 
|
| 
       42 
42 
     | 
    
         
             
                     root_object = @auth + "." + @nested_set[0][:plural]
         
     | 
| 
       43 
43 
     | 
    
         
             
                   end
         
     | 
| 
       44 
44 
     | 
    
         
             
                 end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
       45 
46 
     | 
    
         
             
             %><% if !@god && @nested_set[0][:singular] == @auth_identifier %>
         
     | 
| 
       46 
47 
     | 
    
         
             
                @<%= @nested_set[0][:singular] %> ||= <%= root_object %>
         
     | 
| 
       47 
48 
     | 
    
         
             
             <% else %>
         
     | 
| 
         @@ -63,7 +64,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %> 
     | 
|
| 
       63 
64 
     | 
    
         
             
              def load_<%= singular_name %>
         
     | 
| 
       64 
65 
     | 
    
         
             
                <% if @nested_set[0] && @nested_set[0][:optional] %>if params.include?(:<%= @nested_set.last[:singular] %>_id)
         
     | 
| 
       65 
66 
     | 
    
         
             
                  @<%= singular_name %> = <%= object_scope.gsub("@",'') %>.find(params[:id])
         
     | 
| 
       66 
     | 
    
         
            -
                else <% end %>@<%= singular_name %> = <%= object_scope %>.find(params[:id])<% if @nested_set[0] && @nested_set[0][:optional]  %>
         
     | 
| 
      
 67 
     | 
    
         
            +
                else <% end %>@<%= singular_name %> = <%= object_scope.gsub("@",'') %>.find(params[:id])<% if @nested_set[0] && @nested_set[0][:optional]  %>
         
     | 
| 
       67 
68 
     | 
    
         
             
                end<% end %>
         
     | 
| 
       68 
69 
     | 
    
         
             
              end
         
     | 
| 
       69 
70 
     | 
    
         
             
              <% else %>
         
     | 
    
        data/lib/hotglue/version.rb
    CHANGED
    
    
    
        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.6. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.6.31
         
     | 
| 
       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: 2025-10- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-10-28 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rails
         
     |