質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

4141閲覧

herokuデプロイ後のエラーについて

SpaceRange

総合スコア24

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

1クリップ

投稿2019/02/28 06:31

編集2019/02/28 06:42

いつもお世話になってます。

現在ポートフォリオ用に、aws cloud9でrailsアプリケーションを制作しています。
内容は就職用に自分の特徴をまとめようというもので、新規登録機能、ログイン機能、ユーザ編集機能などをいれました。
一応納得が行くようになるまで完成し、いざデプロイしましたが
トップページが表示され、一通り操作してみようと新規登録を行ったところ、登録ボタンをおした瞬間「We're sorry, but something went wrong.」と表示されエラーとなりました。

$ heroku logs

で確認したところ、

イメージ説明
イメージ説明
イメージ説明
イメージ説明
イメージ説明
イメージ説明
イメージ説明

このように表示されています。
1日悩んでいるのですが、解決方法がいまだにわかりません。
ちなみにデプロイ後は

$ heroku run rails db:migrate

もしました。

一応database.ymlとgemfileも載せておきます。
イメージ説明

source 'https://rubygems.org' ruby "2.5.3" git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "https://github.com/#{repo_name}.git" end # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.6' # Use mysql as the database for Active Record gem 'mysql2', '>= 0.3.18', '< 0.5' # Use Puma as the app server gem 'puma', '~> 3.0' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.2' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library gem 'jquery-rails' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 3.0' # Use ActiveModel has_secure_password gem 'bcrypt', '~> 3.1.7' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platform: :mri end group :development do # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. gem 'web-console', '>= 3.3.0' gem 'listen', '~> 3.0.5' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] gem 'bootstrap', '~> 4.1.1' gem 'rails-i18n' gem 'carrierwave' group :production do gem 'pg', '0.21.0' end

ルーティング

Rails.application.routes.draw do root to: 'top#index' get 'login', to: 'sessions#new' post 'login', to: 'sessions#create' delete 'logout', to: 'sessions#destroy' get 'signup', to: 'users#new' resources :users, only: [:show,:new,:create,:edit,:update,:destroy] get 'users/mypersonality/:id', to: 'users#personal' get 'users/mypersonality/:id/edit', to:'users#personal_edit' patch 'users/mypersonality/:id', to:'users#personal_update' put 'users/mypersonality/:id', to: 'users#personal_update' end

コントローラー

class UsersController < ApplicationController before_action :require_user_logged_in, only: [:index, :show,:edit,:update,:destroy] before_action :forbid_login_user, only: [:index,:new,:create] before_action :ensure_correct_user, only: [:show,:edit,:update,:personal,:personal_edit] def index end def show @user = User.find(params[:id]) end def new @user = User.new end def create @user = User.new(user_params) if @user.save flash[:success] = 'ユーザーを登録しました!ログインしましょう' redirect_to @user else flash.now[:danger] = 'ユーザの登録に失敗しました。' render :new end end def edit @user = User.find(session[:user_id]) end def update @user = User.find(session[:user_id]) if @user.update(user_edit_params) flash[:success] = "変更が適用されました!" redirect_to @user else flash.now[:danger] = "変更が適用されませんでした" render :edit end end def destroy end def personal @user = User.find(session[:user_id]) end def personal_edit @user = User.find(session[:user_id]) end private def user_params params.require(:user).permit(:name, :email, :password, :password_confirmation) end def user_edit_params params.require(:user).permit(:fullname,:email,:birth,:gender,:postal,:prefecture,:address,:phone,:avator,:income,:bestIncome,:experience,:jobStatus,:totalService,:finalEducation,:schoolName,:department,:period,:hope,:manegiment) end def ensure_correct_user if current_user.id != params[:id].to_i flash[:danger] = "権限がありません" redirect_to current_user end end end

遷移後にエラーとなる新規登録画面

<div class="text-center mt-5 mb-5"> <h3>新規登録</h1> </div> <div class="row pb-5"> <div class="col-md-6 col-md-offset-3 mx-auto mb-5"> <%= form_for(@user) do |f| %> <%= render 'layouts/error_messages', model: f.object %> <div class="form-group mb-4"> <%= f.label :name, 'ユーザーネーム'%> <%= f.text_field :name, class: 'form-control' %> </div> <div class="form-group mb-4"> <%= f.label :email, 'E-mail'%> <%= f.email_field :email, class: 'form-control' %> </div> <div class="form-group mb-4"> <%= f.label :password, 'Password'%> <%= f.password_field :password, class: 'form-control' %> </div> <div class="form-group mb-4"> <%= f.label :password_confirmation, 'Confirm'%> <%= f.password_field :password_confirmation, class: 'form-control' %> </div> <%= f.submit '登録', class: 'btn btn-primary btn-block mt-5' %> <% end %> </div> </div>

他に必要な情報があれば追加します。
ご回答よろしくお願いします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

undefined method income と出ています。
incomeというメソッドが未定義 ということです。

まず、ローカルではエラーなく正常に動作していることを再確認して下さい。
それでもローカルでは大丈夫ということであれば、ローカルとデプロイ先のソースが同じ状態ではないと思います。

git status ですべてのファイルがコミットされていることを確認して下さい。
また、その上で git push heroku master を実行済であるかも確認して下さい。

投稿2019/02/28 06:52

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

SpaceRange

2019/02/28 07:01

早急なご回答助かりました。 確認してみます! ちなみに、そちらのエラーはどこで確認できたでしょうか? 面倒でなければ、添付写真何枚目か教えていただけると幸いです よろしくお願いします。
退会済みユーザー

退会済みユーザー

2019/02/28 07:13

2枚目のFATALと出ている所ですね。
SpaceRange

2019/02/28 07:59

ありがとうございます。 すべてコミットされていると思うのですが、同じ動作をしてくれません。 他に方法はありますでしょうか? よろしくお願いします。
退会済みユーザー

退会済みユーザー

2019/02/28 08:08

ログのエラー文言が現状も同じであればソースのデプロイ漏れ以外は考えにくいと思いますね。 git status git push heroku master の結果を追記して頂けますか? エラーの具体的検証でいうと、_user_info_html.erbにincomeというメソッドを使っている所はありませんか? そこが原因です。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問