显示第13行所显示的/home/farhad/apa/blog1/app/views/articles/new.html.erb:
用于#的未定义方法“`phone”
<p>
<strong><%= f.label :phone %></strong>
<%= f.number_field :phone %>
</p><br>
<p>
<strong><%= f.label :gender%></strong><br>发布于 2018-04-23 08:17:57
您的回答是@Stefan评论来自评论部分
如何添加这个?
在articles表不存在phone列上,可以使用migration (类似于
rails g migration AddPhoneToArticles phone:integer这里,phone:string phone是列名,integer是它的数据类型,您可以像string一样更改所需的数据类型。
然后运行迁移,就像
rails db:migrate #only available in Rails 5.x version
#or
rake db:migrate查看Rails中的Creating a Migration官方指南
https://stackoverflow.com/questions/49976022
复制相似问题