user745235
user745235

Reputation:

Heroku Run migration but still doesn't recognize the column

This is my view, where the problem is happening:

<div class="row" style="margin-top:10%;">
    <div class="four columns"></div>
    <div class="four columns">      
        <div class="panel">
            <h2>Criar conta</h2>
            <%= simple_form_for resource, :as => resource_name, :url => registration_path(resource_name), defaults: { error_html: { class: 'alert label' } } do |f| %>
                <div><%= f.input :name, :autofocus => true, :placeholder => "Nome", label: false %></div>
                <div><%= f.input :email, :placeholder => "E-mail", label: false  %></div>
                <div><%= f.input :password, :placeholder => "Senha", label: false  %></div>
                <div><%= f.input :password_confirmation, :placeholder => "Confirme sua senha", label: false  %></div>
                <div align="center">
                    <%= f.submit "Cadastrar", :class => "button success" %>
                </div>
            <% end %>
            <p><%= link_to "Já tenho conta", new_session_path(resource_name) %></p>
        </div>
    </div>
    <div class="four columns" style="margin-top:10%;"></div>
</div>

This is the error message:

ActionView::Template::Error (undefined method `name' for #<User:0x00000003ecda80>):
2013-02-13T18:40:43+00:00 app[web.1]:     4:        <div class="panel">
2013-02-13T18:40:43+00:00 app[web.1]:     5:            <h2>Criar conta</h2>
2013-02-13T18:40:43+00:00 app[web.1]:     6:            <%= simple_form_for resource, :as => resource_name, :url => registration_path(resource_name), defaults: { error_html: { class: 'alert label' } } do |f| %>
2013-02-13T18:40:43+00:00 app[web.1]:     7:                <div><%= f.input :name, :autofocus => true, :placeholder => "Nome", label: false %></div>
2013-02-13T18:40:43+00:00 app[web.1]:     8:                <div><%= f.input :email, :placeholder => "E-mail", label: false  %></div>
2013-02-13T18:40:43+00:00 app[web.1]:     9:                <div><%= f.input :password, :placeholder => "Senha", label: false  %></div>
2013-02-13T18:40:43+00:00 app[web.1]:     10:               <div><%= f.input :password_confirmation, :placeholder => "Confirme sua senha", label: false  %></div>
2013-02-13T18:40:43+00:00 app[web.1]:   app/views/devise/registrations/new.html.erb:7:in `block in _app_views_devise_registrations_new_html_erb___2903664484468264557_32844520'
2013-02-13T18:40:43+00:00 app[web.1]:   app/views/devise/registrations/new.html.erb:6:in `_app_views_devise_registrations_new_html_erb___2903664484468264557_32844520'
2013-02-13T18:40:43+00:00 app[web.1]: 
2013-02-13T18:40:43+00:00 app[web.1]: 

This is part of the table from Heroku (pg:psql) to make sure the column was created:

name                   | character varying(255)      | 
 status                 | boolean                     | 
 confirmed_at           | timestamp without time zone | 
 confirmation_token     | character varying(255)      | 
 confirmation_sent_at   | timestamp without time zone | 

I run rake db:version

Heroku: 20130213174735

Local: 20130213174735

Upvotes: 1

Views: 138

Answers (1)

John Beynon
John Beynon

Reputation: 37507

After you have done a heroku run rake db:migrate you will need to do a heroku restart so Rails recaches the activerecord structure.

Upvotes: 2

Related Questions