Skip to content

Commit 26cae80

Browse files
committed
enable form_with if rails 5.1+
1 parent b4d9457 commit 26cae80

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/generators/haml/scaffold/templates/_form.html.haml

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
<% if Rails::VERSION::MAJOR >= 5 && Rails::VERSION::MINOR >= 1 -%>
2+
= form_with model: @<%= singular_table_name %>, local: true do |f|
3+
<% else -%>
14
= form_for @<%= singular_table_name %> do |f|
5+
<% end -%>
26
- if @<%= singular_table_name %>.errors.any?
37
#error_explanation
48
%h2= "#{pluralize(@<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:"

0 commit comments

Comments
 (0)