简体   繁体   English

Heroku , ActionView::Template::Error (未定义方法`tags&#39; for #<Post:0x000000041424a0> ):

[英]Heroku , ActionView::Template::Error (undefined method `tags' for #<Post:0x000000041424a0>):

So I'm not sure what it is.所以我不确定它是什么。 On local host all works fine.在本地主机上一切正常。

I have got this error in Heroku.我在 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'

Thats what I have:这就是我所拥有的:

1. Viewer 1.查看器

<%= form_for @post  do |f| %>

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

2. Controller 2. 控制器

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

3. Model 3. 型号

attr_accessible :entry, :title, :private, :tags

4. Schema 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

Did you forget to heroku run rake db:migrate ?您是否忘记了heroku run rake db:migrate

You may also need to heroku restart if your application is already running and has cached the old data model.如果您的应用程序已经在运行并且缓存了旧的数据模型,您可能还需要heroku restart

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 heroku ActionView :: Template :: Error(未定义的方法“电子邮件” - heroku ActionView::Template::Error (undefined method `email' Heroku 错误:ActionView::Template::Error(未定义方法 `captcha&#39; for #<Message:0x007fc9df016930> ) - Heroku Error: ActionView::Template::Error (undefined method `captcha' for #<Message:0x007fc9df016930>) Heroku 问题,ActionView::Template::Error(nil:NilClass 的未定义方法“名称”): - Heroku issue, ActionView::Template::Error (undefined method `name' for nil:NilClass): ActionView :: Template :: Error(未定义方法…)在本地工作,但不适用于Heroku - ActionView::Template::Error (undefined method…) Works locally, but not on Heroku ActionView中的Heroku未定义方法错误 - Heroku undefined method error in ActionView Rails heroku ActionView::Template::Error(未定义的方法`author&#39; - Rails heroku ActionView::Template::Error (undefined method `author' Heroku ActionView :: Template :: Error(nil:NilClass的未定义方法“名称”) - Heroku ActionView::Template::Error (undefined method `name' for nil:NilClass) 在Heroku上的ActionView :: Template :: Error(nil:NilClass的未定义方法“ program”) - ActionView::Template::Error (undefined method `program' for nil:NilClass) on heroku ActionView :: Template :: Error:ActionView :: Template :: Error:未定义的方法`[]&#39;为nil:NilClass - ActionView::Template::Error: ActionView::Template::Error: undefined method `[]' for nil:NilClass ActionView :: Template :: Error(未定义的方法`沉默&#39;为) - ActionView::Template::Error (undefined method `silence' for)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM