Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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

<%= 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. Model

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

4. Schema

  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
like image 301
vekozlov Avatar asked Oct 05 '12 15:10

vekozlov


1 Answers

Did you forget to 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.

like image 149
willglynn Avatar answered Oct 12 '22 08:10

willglynn