Repository: rails/tailwindcss-rails (Ruby)

Issue:
View files generated by scaffold cause `ActionView::MissingTemplate` when the Model name is nested
View files generated by scaffold cause `ActionView::MissingTemplate` when the Model name is nested.

```
$ rails new myapp --css=tailwind
$ cd myapp
$ bin/rails generate scaffold Foo/Bar title:string body:text
$ bin/rails db:migrate
$ bin/rails r 'Foo::Bar.create'
$ bin/rails s
$ curl -is http://localhost:3000/foo/bars | grep MissingTemplate
    ActionView::MissingTemplate in
</div><div class="line active">        raise(MissingTemplate.new(self, path, prefixes, partial, details, details_key, locals))
```

Probably [this line](https://github.com/rails/tailwindcss-rails/blob/main/lib/generators/tailwindcss/scaffold/scaffold_generator.rb#L25) is wrong, and `singular_name` should be used instead of `singular_table_name` like [rails/rails](https://github.com/rails/rails/blob/ade4e7a907e4fd36f0835f9c4150817fb978dfbd/railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb#L25), but I'm not 100% sure.


Discussion:

Patch:
diff --git a/lib/generators/tailwindcss/scaffold/scaffold_generator.rb b/lib/generators/tailwindcss/scaffold/scaffold_generator.rb
index 3ae3c99d..6c1a2101 100644
--- a/lib/generators/tailwindcss/scaffold/scaffold_generator.rb
+++ b/lib/generators/tailwindcss/scaffold/scaffold_generator.rb
@@ -22,7 +22,7 @@ def copy_view_files
           end
         end
 
-        template "partial.html.erb", File.join("app/views", controller_file_path, "_#{singular_table_name}.html.erb")
+        template "partial.html.erb", File.join("app/views", controller_file_path, "_#{singular_name}.html.erb")
       end
 
       private
@@ -31,4 +31,4 @@ def available_views
         end
     end
   end
-end
\ No newline at end of file
+end
diff --git a/lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt b/lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt
index 301d82f2..55717003 100644
--- a/lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt
+++ b/lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt
@@ -1,22 +1,22 @@
-<div id="<%%= dom_id <%= singular_table_name %> %>">
+<div id="<%%= dom_id <%= singular_name %> %>">
 <% attributes.reject(&:password_digest?).each do |attribute| -%>
   <p class="my-5">
     <strong class="block font-medium mb-1"><%= attribute.human_name %>:</strong>
 <% if attribute.attachment? -%>
-    <%%= link_to <%= singular_table_name %>.<%= attribute.column_name %>.filename, <%= singular_table_name %>.<%= attribute.column_name %> if <%= singular_table_name %>.<%= attribute.column_name %>.attached? %>
+    <%%= link_to <%= singular_name %>.<%= attribute.column_name %>.filename, <%= singular_name %>.<%= attribute.column_name %> if <%= singular_name %>.<%= attribute.column_name %>.attached? %>
 <% elsif attribute.attachments? -%>
-    <%% <%= singular_table_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %>
+    <%% <%= singular_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %>
       <div><%%= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> %></div>
     <%% end %>
 <% else -%>
-    <%%= <%= singular_table_name %>.<%= attribute.column_name %> %>
+    <%%= <%= singular_name %>.<%= attribute.column_name %> %>
 <% end -%>
   </p>
 
 <% end -%>
   <%% if action_name != "show" %>
-    <%%= link_to "Show this <%= human_name.downcase %>", <%= singular_table_name %>, class: "rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
-    <%%= link_to 'Edit this <%= human_name.downcase %>', edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %>
+    <%%= link_to "Show this <%= human_name.downcase %>", <%= singular_name %>, class: "rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+    <%%= link_to 'Edit this <%= human_name.downcase %>', edit_<%= singular_name %>_path(<%= singular_name %>), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %>
     <hr class="mt-6">
   <%% end %>
 </div>


Test patch:
diff --git a/test/lib/generators/tailwindcss/scaffold_generator_test.rb b/test/lib/generators/tailwindcss/scaffold_generator_test.rb
index 2973a7a4..01d892b2 100644
--- a/test/lib/generators/tailwindcss/scaffold_generator_test.rb
+++ b/test/lib/generators/tailwindcss/scaffold_generator_test.rb
@@ -12,4 +12,10 @@ class Tailwindcss::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCa
 
     %w(index edit new show _form _message).each { |view| assert_file "app/views/messages/#{view}.html.erb" }
   end
+
+  test "with namespace invoked" do
+    run_generator [ "admin/role", "name:string", "description:string" ]
+
+    %w(index edit new show _form _role).each { |view| assert_file "app/views/admin/roles/#{view}.html.erb" }
+  end
 end