mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
for ... in => .each
I believe this is more modern way
This commit is contained in:
parent
9d8e2fb5e2
commit
22ed6cb798
7 changed files with 10 additions and 10 deletions
|
@ -11,7 +11,7 @@
|
|||
</div>
|
||||
<%% end %>
|
||||
|
||||
<% for attribute in attributes -%>
|
||||
<% attributes.each do |attribute| -%>
|
||||
<div class="field">
|
||||
<%%= f.label :<%= attribute.name %> %><br />
|
||||
<%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<table>
|
||||
<tr>
|
||||
<% for attribute in attributes -%>
|
||||
<% attributes.each do |attribute| -%>
|
||||
<th><%= attribute.human_name %></th>
|
||||
<% end -%>
|
||||
<th></th>
|
||||
|
@ -12,7 +12,7 @@
|
|||
|
||||
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
||||
<tr>
|
||||
<% for attribute in attributes -%>
|
||||
<% attributes.each do |attribute| -%>
|
||||
<td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
|
||||
<% end -%>
|
||||
<td><%%= link_to 'Show', <%= singular_table_name %> %></td>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<p id="notice"><%%= notice %></p>
|
||||
|
||||
<% for attribute in attributes -%>
|
||||
<% attributes.each do |attribute| -%>
|
||||
<p>
|
||||
<b><%= attribute.human_name %>:</b>
|
||||
<%%= @<%= singular_table_name %>.<%= attribute.name %> %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<% module_namespacing do -%>
|
||||
class <%= class_name %>Controller < ApplicationController
|
||||
<% for action in actions -%>
|
||||
<% actions.each do |action| -%>
|
||||
def <%= action %>
|
||||
end
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class <%= class_name %>ControllerTest < ActionController::TestCase
|
|||
# assert true
|
||||
# end
|
||||
<% else -%>
|
||||
<% for action in actions -%>
|
||||
<% actions.each do |action| -%>
|
||||
test "should get <%= action %>" do
|
||||
get :<%= action %>
|
||||
assert_response :success
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
|||
|
||||
<% module_namespacing do -%>
|
||||
class <%= class_name %>Test < ActionMailer::TestCase
|
||||
<% for action in actions -%>
|
||||
<% actions.each do |action| -%>
|
||||
test "<%= action %>" do
|
||||
mail = <%= class_name %>.<%= action %>
|
||||
assert_equal <%= action.to_s.humanize.inspect %>, mail.subject
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
<% unless attributes.empty? -%>
|
||||
one:
|
||||
<% for attribute in attributes -%>
|
||||
<% attributes.each do |attribute| -%>
|
||||
<%= attribute.name %>: <%= attribute.default %>
|
||||
<% end -%>
|
||||
|
||||
two:
|
||||
<% for attribute in attributes -%>
|
||||
<% attributes.each do |attribute| -%>
|
||||
<%= attribute.name %>: <%= attribute.default %>
|
||||
<% end -%>
|
||||
<% else -%>
|
||||
|
@ -20,4 +20,4 @@ one: {}
|
|||
#
|
||||
two: {}
|
||||
# column: value
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
|
|
Loading…
Reference in a new issue