gpt4 book ai didi

ruby-on-rails - Heroku , ActionView::Template::Error (未定义方法 `tags' 用于 #):

转载 作者:行者123 更新时间:2023-12-04 16:19:32 25 4
gpt4 key购买 nike

所以我不确定它是什么。
在本地主机上一切正常。

我在 Heroku 中遇到了这个错误。

Started GET "/posts/new" for 79.111.231.233 at 2012-10-05 08:04:17 -0700
app/views/posts/new.html.erb:2:in `_app_views_posts_new_html_erb__735551054742361459_22419140'
app/views/shared/_post_form.html.erb:22:in `block in _app_views_shared__post_form_html_erb__2081576675630015699_18673940'
22: <%= f.text_field :tags %>
app/views/shared/_post_form.html.erb:5:in `_app_views_shared__post_form_html_erb__2081576675630015699_18673940'
25: <div class="actions">
21: <div class="">
cache: [GET /posts/new] miss
ActionView::Template::Error (undefined method `tags' for #<Post:0x000000041424a0>):
app/controllers/posts_controller.rb:19:in `new'

这就是我所拥有的:

1.观众
<%= form_for @post  do |f| %>

...
<%= f.text_field :tags %>
...



2. Controller
  def new
@page_title = 'New post'
@user = current_user
@post = Post.new
render 'new'
end

3.型号
attr_accessible :entry, :title, :private, :tags

4.架构
  create_table "posts", :force => true do |t|
t.string "title", :null => false
t.text "entry", :null => false
t.integer "user_id"
t.integer "category_id"
t.boolean "private", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "tags"
end

最佳答案

你忘记了吗heroku run rake db:migrate ?

您可能还需要heroku restart如果您的应用程序已经在运行并且缓存了旧的数据模型。

关于ruby-on-rails - Heroku , ActionView::Template::Error (未定义方法 `tags' 用于 #<Post:0x000000041424a0>):,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12749472/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com