0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Ruby on Rails】繰り返しメソッドをビューで出力したとき最後に余計な数字が出る。

Posted at
<%= (0..2).each do |n| %>
<%= n %>
<% end %>

のようにviewに出力すると

0 1 2 0..2

のように0..2というような文字が出力されてしまいます。これを表示させないためには
<%= を <%にするというごく単純な問題でした。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?