Skip to content

Commit 144f9d6

Browse files
committed
Rails 5 doesn't have attachment/s
1 parent 4e992cf commit 144f9d6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<div class="my-5">
2222
<%%= form.label :password_confirmation %>
2323
<%%= form.password_field :password_confirmation, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
24-
<% elsif attribute.attachments? -%>
24+
<% elsif attribute.try(:attachments?) -%>
2525
<%%= form.label :<%= attribute.column_name %> %>
2626
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
2727
<% else -%>

lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<% attributes.reject(&:password_digest?).each do |attribute| -%>
33
<p class="my-5">
44
<strong class="block font-medium mb-1"><%= attribute.human_name %>:</strong>
5-
<% if attribute.attachment? -%>
5+
<% if attribute.try(:attachment?) -%>
66
<%%= link_to <%= singular_table_name %>.<%= attribute.column_name %>.filename, <%= singular_table_name %>.<%= attribute.column_name %> if <%= singular_table_name %>.<%= attribute.column_name %>.attached? %>
7-
<% elsif attribute.attachments? -%>
7+
<% elsif attribute.try(:attachments?) -%>
88
<%% <%= singular_table_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %>
99
<div><%%= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> %></div>
1010
<%% end %>

0 commit comments

Comments
 (0)