rails tutorialを10章まで終わらせてherokuへpushしてみました。
rootページやhelpページは表示されますが、signupやloginページは真っ白で何も表示されません。
ローカルでは問題ありません。
$ rails test $ git push heroku $ heroku pg:reset DATABASE $ heroku run rails db:migrate $ heroku run rails db:seed $ heroku restart
このようなコマンドを打ちました。
$ heroku run rails db:seedのときにエラーが出ました。
$ heroku run rails db:seed Running rails db:seed on ⬢ whispering-brook-22978... up, run.2149 (Free) D, [2018-02-13T05:18:04.095669 #4] DEBUG -- : (1.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC rails aborted! ActiveModel::UnknownAttributeError: unknown attribute 'admin' for User.
db/seeds.rb
User.create!(name: "Example User", email: "example@railstutorial.org", password: "foobar", password_confirmation: "foobar", admin: true) 99.times do |n| name = Faker::Name.name email = "example-#{n+1}@railstutorial.org" password = "password" User.create!(name: name, email: email, password: password, password_confirmation: password) end
class AddAdminToUsers < ActiveRecord::Migration[5.1] def change add_column :users, :admin, :boolean, default: false end end
ActiveRecord::Schema.define(version: 20180110193732) do create_table "users", force: :cascade do |t| t.string "name" t.string "email" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "password_digest" t.string "remember_digest" t.boolean "admin", default: false t.index ["email"], name: "index_users_on_email", unique: true end end
$ heroku run rails db:seed Running rails db:seed on ⬢ whispering-brook-22978... up, run.3009 (Free) D, [2018-02-14T11:22:53.254427 #4] DEBUG -- : (3.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC rails aborted! ActiveModel::UnknownAttributeError: unknown attribute 'admin' for User. /app/vendor/bundle/ruby/2.3.0/gems/activemodel-5.1.4/lib/active_model/attribute_assignment.rb:48:in `_assign_attribute' /app/vendor/bundle/ruby/2.3.0/gems/activemodel-5.1.4/lib/active_model/attribute_assignment.rb:40:in `block in _assign_attributes' /app/vendor/bundle/ruby/2.3.0/gems/activemodel-5.1.4/lib/active_model/attribute_assignment.rb:39:in `each' /app/vendor/bundle/ruby/2.3.0/gems/activemodel-5.1.4/lib/active_model/attribute_assignment.rb:39:in `_assign_attributes' /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/attribute_assignment.rb:26:in `_assign_attributes' /app/vendor/bundle/ruby/2.3.0/gems/activemodel-5.1.4/lib/active_model/attribute_assignment.rb:33:in `assign_attributes' /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/core.rb:337:in `initialize' /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/inheritance.rb:66:in `new' /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/inheritance.rb:66:in `new' /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/persistence.rb:50:in `create!' /app/db/seeds.rb:1:in `<top (required)>' /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load' /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load' /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency' /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load' /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:549:in `load_seed' /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:270:in `load_seed' /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/railties/databases.rake:184:in `block (2 levels) in <top (required)>' /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:21:in `block in perform' /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:18:in `perform' /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:46:in `invoke' /app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>' /app/bin/rails:9:in `require' /app/bin/rails:9:in `<main>' Tasks: TOP => db:seed (See full trace by running task with --trace)
ご回答お願いします!
あなたの回答
tips
プレビュー