Wednesday, 15 February 2012

ruby - Rails: ActionView::Template::Error - undefined method 'comment' -



ruby - Rails: ActionView::Template::Error - undefined method 'comment' -

i have problem rendering form input data. controller looks this:

class adscontroller < applicationcontroller def new @ad = current_user.ads.build() respond_to |format| format.html { render :layout => 'new' }# new.html.erb format.json { render json: @ad } end end end

in view (the relevant parts):

<%= form_for ([@ad.user, @ad]) |f| %> ... <%= f.label 'description' %></div> <%= f.text_area :comment, cols:35, rows:4 %> ... <% end %>

and model:

class advertisement < activerecord::base attr_accessible :title, :url, :comment, :category_id, :layout, :user_id ... end

when render form, error:

actionview::template::error (undefined method `comment' for

)

it's weird, because on localhost it's working, after uploading app heroku getting error.

where problem?

check migrations:

$ heroku run rake db:migrate:status

confirm you've ran migrations. heroku not automatically run migrations when force new code.

run $ heroku run rake db:migrate run them.

ruby-on-rails ruby heroku

No comments:

Post a Comment