初めて質問させていただきます。
Railsを使って初めのウェブサイトを作っており、Herokuに公開しようとしました。
初めは全てのページが見れていました。
ですが、サイトの機能であるデータベースへの情報の入力を行ったところ、
その後から急に画面が表示できなくなり、「The page you were looking for doesn't exist.」
の表示が出るようになりました。
そこで、試しにSequel Proを使ってデータベース内のデータを直接削除すると、
再びページが表示できるようになりました。
(しかし、もう一度データを入力するとまた同じ現象となります。)
データベースに入力をしてもきちんとページを表示する方法はないものでしょうか。
以下、ソースコード等です。
何が必要となるかわからなかったのでとりあえず必要そうなものを書き出しました。
もし他に別のものが必要でしたら言ってください。
/config/database.yml
default: &default adapter: mysql2 encoding: utf8 pool: 5 username: root password: socket: /tmp/mysql.sock development: <<: *default database: shareipt_development test: <<: *default database: shareipt_test production: adapter: mysql2 database: <%= ENV['DB_NAME'] %> username: <%= ENV['DB_USERNAME'] %> password: <%= ENV['DB_PASSWORD'] %> host: <%= ENV['DB_HOSTNAME'] %> port: <%= ENV['DB_PORT'] %>
routes.rb
lang
1Rails.application.routes.draw do 2 devise_for :users 3 root 'receipts#index' 4 get 'receipts' => 'receipts#index' 5 get 'receipts/new' => 'receipts#new' 6 post 'receipts' => 'receipts#create' 7 get 'users/:id' => 'users#show' 8 delete 'receipts/:id' => 'receipts#destroy' 9 get 'receipts/:id/edit' => 'receipts#edit' 10 patch 'receipts/:id' => 'receipts#update' 11end
Gemfile
lang
1source 'https://rubygems.org' 2gem 'rails', '4.2.1' 3gem 'mysql2' 4gem 'sass-rails', '~> 4.0.2' 5gem 'uglifier', '>= 1.3.0' 6gem 'coffee-rails', '~> 4.1.0' 7gem 'turbolinks' 8gem 'jbuilder', '~> 2.0' 9gem 'byebug' 10gem 'web-console', '~> 2.0' 11gem 'spring' 12gem 'pry-rails' 13gem 'compass-rails','~> 2.0' 14gem 'sprockets', '2.11.0' 15gem 'kaminari' 16gem 'devise' 17gem 'rails_12factor' 18gem 'sdoc', '~> 0.4.0', group: :doc 19group :development, :test do 20end
secrets.yml
development: secret_key_base: c149492e994d56d8e74ed45e5ae4f0a79c35cb61a1b6e8755b4d2c70ee342b6582d0fd44923b228bf80eb661050ac78148e16c441c0ecdc602e5f34dfe0c05ba test: secret_key_base: 7f9a67de771177d1a77599b88d2ce76b52ea5edd86255e9961a7a714ecaeeaa9fb25ffc311aaf7e80aaa874256c15139ac7ac484bdc93e85d2b247ba8284152f secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
【追記】heroku logs
2015-04-22T15:50:28.152801+00:00 heroku[web.1]: State changed from down to starting 2015-04-22T15:50:28.152558+00:00 heroku[web.1]: Unidling 2015-04-22T15:50:32.330348+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 54072 -e production` 2015-04-22T15:50:35.169280+00:00 app[web.1]: Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance. 2015-04-22T15:50:37.919766+00:00 app[web.1]: => Booting WEBrick 2015-04-22T15:50:37.919781+00:00 app[web.1]: => Rails 4.2.1 application starting in production on http://0.0.0.0:54072 2015-04-22T15:50:37.919783+00:00 app[web.1]: => Run `rails server -h` for more startup options 2015-04-22T15:50:37.919789+00:00 app[web.1]: => Ctrl-C to shutdown server 2015-04-22T15:50:39.165815+00:00 app[web.1]: [2015-04-22 15:50:39] INFO WEBrick 1.3.1 2015-04-22T15:50:39.165905+00:00 app[web.1]: [2015-04-22 15:50:39] INFO ruby 2.0.0 (2015-04-13) [x86_64-linux] 2015-04-22T15:50:39.166270+00:00 app[web.1]: [2015-04-22 15:50:39] INFO WEBrick::HTTPServer#start: pid=3 port=54072 2015-04-22T15:50:39.405421+00:00 heroku[web.1]: State changed from starting to up 2015-04-22T15:50:51.450418+00:00 heroku[router]: at=info method=GET path="/" host=hatabohh.herokuapp.com request_id=8b578bc7-a235-473b-8fb8-bfdef3a3f3a5 fwd="36.12.15.215" dyno=web.1 connect=1ms service=9238ms status=404 bytes=1829 2015-04-22T15:50:51.851896+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=hatabohh.herokuapp.com request_id=fa5b9c59-1c77-41f5-ba2a-bf24e459347c fwd="36.12.15.215" dyno=web.1 connect=1ms service=11ms status=304 bytes=133 2015-04-22T15:52:01.590293+00:00 heroku[router]: at=info method=GET path="/" host=hatabohh.herokuapp.com request_id=9baee8cf-8cd0-425e-845f-8b3dd6346345 fwd="36.12.15.215" dyno=web.1 connect=4ms service=62ms status=404 bytes=1829
よろしくお願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/04/22 16:01
2015/04/22 18:51