Skip to content

Commit

Permalink
enable form_with if rails 5.1+
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ueda committed Nov 8, 2017
1 parent b4d9457 commit 26cae80
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/generators/haml/scaffold/templates/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<% if Rails::VERSION::MAJOR >= 5 && Rails::VERSION::MINOR >= 1 -%>
= form_with model: @<%= singular_table_name %>, local: true do |f|
<% else -%>
= form_for @<%= singular_table_name %> do |f|
<% end -%>
- if @<%= singular_table_name %>.errors.any?
#error_explanation
%h2= "#{pluralize(@<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:"
Expand Down

0 comments on commit 26cae80

Please sign in to comment.