https://qiita.com/kazukimatsumoto/items/a0daa7281a3948701c39のサイトをもとにherokuを使っていたのですがエラーが出てしまいました。
エラー(heroku run rails db:migrateする前)
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
we're sorry, but something went wrong.
エラー2(heroku run rails db:migrateをしたら)
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
The page you were looking for doesn't exist.
log
12019-10-07T11:24:43.974292+00:00 heroku[router]: at=info method=GET path="/" host=safe-beyond-98038.herokuapp.com request_id=0de62b89-9454-418a-97da-761b0cfad0a5 fwd="126.159.251.241" dyno=web.1 connect=0ms service=8ms status=404 bytes=1902 protocol=https 22019-10-07T11:24:43.965832+00:00 app[web.1]: I, [2019-10-07T11:24:43.965742 #4] INFO -- : [0de62b89-9454-418a-97da-761b0cfad0a5] Started GET "/" for 126.159.251.241 at 2019-10-07 11:24:43 +0000 32019-10-07T11:24:43.966735+00:00 app[web.1]: I, [2019-10-07T11:24:43.966654 #4] INFO -- : [0de62b89-9454-418a-97da-761b0cfad0a5] Processing by BlogsController#index as HTML 42019-10-07T11:24:43.970965+00:00 app[web.1]: D, [2019-10-07T11:24:43.970887 #4] DEBUG -- : [0de62b89-9454-418a-97da-761b0cfad0a5] Blogconfig Load (0.8ms) SELECT "blogconfigs".* FROM "blogconfigs" WHERE "blogconfigs"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]] 52019-10-07T11:24:43.971359+00:00 app[web.1]: I, [2019-10-07T11:24:43.971303 #4] INFO -- : [0de62b89-9454-418a-97da-761b0cfad0a5] Completed 404 Not Found in 5ms (ActiveRecord: 0.8ms) 62019-10-07T11:24:43.971737+00:00 app[web.1]: F, [2019-10-07T11:24:43.971685 #4] FATAL -- : [0de62b89-9454-418a-97da-761b0cfad0a5] 72019-10-07T11:24:43.971782+00:00 app[web.1]: F, [2019-10-07T11:24:43.971738 #4] FATAL -- : [0de62b89-9454-418a-97da-761b0cfad0a5] ActiveRecord::RecordNotFound (Couldn't find Blogconfig with 'id'=1): 82019-10-07T11:24:43.971818+00:00 app[web.1]: F, [2019-10-07T11:24:43.971779 #4] FATAL -- : [0de62b89-9454-418a-97da-761b0cfad0a5] 92019-10-07T11:24:43.971870+00:00 app[web.1]: F, [2019-10-07T11:24:43.971829 #4] FATAL -- : [0de62b89-9454-418a-97da-761b0cfad0a5] app/controllers/blogs_controller.rb:13:in `index'
git push heroku master
git push heroku master Enumerating objects: 7, done. Counting objects: 100% (7/7), done. Delta compression using up to 4 threads Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 426 bytes | 213.00 KiB/s, done. Total 4 (delta 3), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Ruby app detected remote: -----> Compiling Ruby/Rails remote: -----> Using Ruby version: ruby-2.5.5 remote: remote: ###### WARNING: remote: remote: Removing `Gemfile.lock` because it was generated on Windows. remote: Bundler will do a full resolve so native gems are handled properly. remote: This may result in unexpected gem versions being used in your app. remote: In rare occasions Bundler may not be able to resolve your dependencies at all. remote: https://devcenter.heroku.com/articles/bundler-windows-gemfile remote: remote: -----> Installing dependencies using bundler 2.0.2 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 remote: The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. remote: Fetching gem metadata from https://rubygems.org/............. remote: Fetching gem metadata from https://rubygems.org/. remote: Resolving dependencies..... remote: Using rake 13.0.0 remote: Using concurrent-ruby 1.1.5 remote: Using minitest 5.12.2 (省略) remote: ###### WARNING: remote: remote: No Procfile detected, using the default web server. remote: We recommend explicitly declaring how to boot your server process via a Procfile. remote: https://devcenter.heroku.com/articles/ruby-default-web-server remote: remote: remote: -----> Discovering process types remote: Procfile declares types -> (none) remote: Default types for buildpack -> console, rake, web remote: remote: -----> Compressing... remote: Done: 78.2M remote: -----> Launching... remote: Released v7 remote: https://XXXXXXXXXXXXXX.herokuapp.com/ deployed to Heroku remote: remote: Verifying deploy... done. To https://git.heroku.com/XXXXXXXX.git 9284a8f..ec76d29 master -> master
初心者なので優しく答えていただけると嬉しいです。
追加
indexメゾット
1 def index 2 page_size = 5 3 @page_num = 0 4 if params[:page] != nil then 5 @page_num = params[:page].to_i 6 end 7 @data = Blogpost.all.order('created_at desc') 8 .offset(page_size * @page_num) 9 .limit(page_size) 10 @blogconfig = Blogconfig.find 1 11 end
root 'blogs#index' get 'blog/index' get 'blogs', to: 'blogs#index' get 'blogs/:page', to: 'blogs#index'
回答1件
あなたの回答
tips
プレビュー