---
# System prepended metadata

title: Rails 在views顯示error訊息
tags: [ruby, rails]

---

# Rails 在views顯示error訊息

###### tags: `rails`, `ruby`
環境:
> ruby 2.6.7
> 
> Rails 6.1.3.1
> 
> Ubuntu 20.04 LTS
> 

<!-- <font size=4></font> -->
<!-- <font color="red"</font> -->


## :memo:

### Step 1: 移至相關View(html.erb)

```ruby=
<% @user.errors.full_messages.each do |message| %>       
    <div class="form-error">
        <%= message %>
    </div>
<% end %>
```
