1

これは、問題が発生している私の見解です。

<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>

これはエラーメッセージです:

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]: 

これは、列が作成されたことを確認するための Heroku (pg:psql) のテーブルの一部です。

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

走るrake db:version

ヘロク: 20130213174735

ローカル: 20130213174735

4

1 に答える 1

2

実行した後、heroku run rake db:migrate実行する必要がありますheroku restart。これにより、Railsはactiverecord構造を再キャッシュします。

于 2013-02-13T22:40:36.443 に答える