0
我在我的Author
模型中驗證了該模型,該模型在創建新的Author
之前檢查當前User
已與Author
記錄關聯。在驗證觸發時,錯誤消息不會顯示在窗體中。未出現在Simple_Form中的Rails驗證錯誤
author.rb
belongs_to :user
validates :user, :uniqueness => {:message=>"An author account already exists for this user"}
作者#新
<%= simple_form_for(@author) do |f| %>
<%= f.error_notification %>
<%= f.input :first_name %>
<%= f.input :last_name %>
<%= f.input :bio %>
<%= f.button :submit %>
<% end %>
什麼情況是,它表明有一個錯誤,但不會出現任何消息。我怎樣才能解決這個問題?謝謝!