Heroku,ActionView :: Template :: Error(#post:0x0000000414240>的未定义方法`tags'):</post:0x000000041424a0>

时间:2012-10-05 15:30:39

标签: ruby-on-rails heroku error-handling tags undefined

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

我在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| %>

...     &lt;%= f.text_field:tags%&gt; ...

 

2。控制器

  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

1 个答案:

答案 0 :(得分:25)

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

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