2014-12-19 3 views
0

Эта ошибка фокусируется на учетных записях пользователей. Я использую драгоценный камень. Приложение работает нормально локально, я нажал на Heroku, и моя страница регистрации пользователя не удалась. Вот что я нашел в журналах Heroku:Неопределенная ошибка метода на Heroku, но не локально

ActionView::Template::Error (undefined method `name' for #<User:0x0000000455e958>): 

app/views/devise/registrations/new.html.erb:12:in `block in _app_views_devise_registrations_new_html_erb___4334866443448261327_23317620' 

приложение/просмотров/DEViSE/регистрация/new.html.erb

<div class="panel panel-default"> 
    <div class="panel-heading"> 
    <h1>Sign up</h1> 
    </div> 

    <div class="panel-body"> 
    <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> 
     <%= devise_error_messages! %> 

     <div class="form-group"> 
     <%= f.label :name %> 
     <%= f.text_field :name, autofocus: true, class: "form-control" %> 
     </div> 

     <div class="form-group"> 
     <%= f.label :email %> 
     <%= f.email_field :email, autofocus: true, class: "form-control" %> 
     </div> 

     <div class="form-group"> 
     <%= f.label :password %> 
     <%= f.password_field :password, class: "form-control" %> 
     </div> 

     <div class="form-group"> 
     <%= f.submit "Sign up", class: "btn btn-primary" %> 
     </div> 
    <% end %> 
    </div> 

    <div class="panel-footer"> 
    <%= render "devise/shared/links" %> 
    </div> 
</div> 

Gemfile

source 'https://rubygems.org' 

ruby "1.9.3" 

gem 'rails', '3.2.8' 
gem 'jquery-rails' 
gem 'devise' 
gem 'simple_form' 
gem 'paperclip' 
gem 'cocaine' 
gem 'acts_as_list' 
gem 'annotate', '2.5.0' 
gem "bugsnag" 
gem 'bootstrap-sass', '~> 2.2.2.0' 

group :production do 
    gem 'pg' 
end 

group :development, :test do 
    gem 'sqlite3' 
end 


group :assets do 
    gem 'sass-rails', '~> 3.2.3' 
    gem 'coffee-rails', '~> 3.2.1' 
    gem 'uglifier', '>= 1.0.3' 
end 

user.rb

class User < ActiveRecord::Base 
    # Include default devise modules. Others available are: 
    # :token_authenticatable, :confirmable, 
    # :lockable, :timeoutable and :omniauthable 
    devise :database_authenticatable, :registerable, 
     :recoverable, :rememberable, :trackable, :validatable 

    # Setup accessible (or protected) attributes for your model 
    attr_accessible :email, :password, :password_confirmation, :remember_me, :name 
    # attr_accessible :title, :body 
end 

application_controller.rb

class ApplicationController < ActionController::Base 
    protect_from_forgery 
end 

schema.rb (LOCAL)

ActiveRecord::Schema.define(:version => 20141219083930) do 

    create_table "items", :force => true do |t| 
    t.string "name" 
    t.string "description" 
    t.boolean "completed", :default => false 
    t.integer "list_id" 
    t.datetime "created_at",      :null => false 
    t.datetime "updated_at",      :null => false 
    t.integer "position" 
    end 

    add_index "items", ["list_id"], :name => "index_items_on_list_id" 

    create_table "lists", :force => true do |t| 
    t.string "name" 
    t.string "description" 
    t.datetime "created_at", :null => false 
    t.datetime "updated_at", :null => false 
    t.integer "position" 
    end 

    create_table "users", :force => true do |t| 
    t.string "email",     :default => "", :null => false 
    t.string "encrypted_password",  :default => "", :null => false 
    t.string "reset_password_token" 
    t.datetime "reset_password_sent_at" 
    t.datetime "remember_created_at" 
    t.integer "sign_in_count",   :default => 0 
    t.datetime "current_sign_in_at" 
    t.datetime "last_sign_in_at" 
    t.string "current_sign_in_ip" 
    t.string "last_sign_in_ip" 
    t.datetime "created_at",        :null => false 
    t.datetime "updated_at",        :null => false 
    t.string "name" 
    end 

    add_index "users", ["email"], :name => "index_users_on_email", :unique => true 
    add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true 

end 

add_name_to_users миграция

class AddNameToUsers < ActiveRecord::Migration 
    def change 
    add_column :users, :name, :string 
    end 
end 
+2

Кажется, существуют различия в схеме БД между средами разработки и производства. Проверьте свои миграции и 'db/schema.rb'. –

+0

Я добавил файл локальной схемы в свое описание –

+0

Спасибо, я сравню эти файлы –

ответ

0

Heroku не имеют одни и те же данные схемы, потому что я не совершал и нажмите дб/development.sqlite3

These files were not staged for commit

Смежные вопросы