我是 Rails 新手,所以我使用了 rails generate scaffold 方法并為“理發師”模型創建了 CRUD 功能。
我已經根據自己的喜好使用引導程式編輯了 index.html.erb,沒有任何問題。
這是我的 new.html.erb 檔案。
<h1>New Barber</h1>
<%= render 'form', barber: @barber %>
<%= link_to 'Back', barbers_path %>
這就是我的理發師模型的樣子。
t.string "first_name"
t.string "last_name"
t.integer "age"
t.string "email"
我在 new.html.erb 檔案中顯示了這個丑陋的表單,用于創建新的理發師記錄,但我不知道如何或在哪里可以修改此表單的視圖?
uj5u.com熱心網友回復:
我假設您使用了此處rails generate scaffold記錄的命令。您的問題的答案在此處列為。將“posts”替換為“barbers”以找到您要查找的檔案。app/views/posts/_form.html.erb
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/441503.html
標籤:轨道上的红宝石
上一篇:在最近的設計版本中,引數“case_insensitive_keys”是否會在驗證期間降低鍵的大小,如果不是,哪個版本解決了這個問題?
