我的Rails应用程序在开发中工作并且没有错误地推送到Heroku,但是页面不存在

时间:2017-12-03 20:34:25

标签: ruby-on-rails heroku

请帮帮我。我注意到这个问题已被问过几次没有答案。我已经尝试了我见过的解决方案,并且没有解决方案。

我正在通过一本书来学习ruby on" Rails Crash Course:Ruby on Rails的No Nonsence指南"。

当我进入Heroku Open

时出现问题

浏览器打开,我收到以下消息

您要查找的页面不存在。 您可能输错了地址或页面可能已移动。 如果您是应用程序所有者,请检查日志以获取更多信息。

我已经运行了我的日志

class PostsController < ApplicationController
  before_action :set_post, only: [:show, :edit, :update, :destroy]

  # GET /posts
  # GET /posts.json
  def index
    @posts = Post.all
  end

  # GET /posts/1
  # GET /posts/1.json
  def show
  end

  # GET /posts/new
  def new
    @post = Post.new
  end

  # GET /posts/1/edit
  def edit
  end

  # POST /posts
  # POST /posts.json
  def create
    @post = Post.new(post_params)

    respond_to do |format|
      if @post.save
        format.html { redirect_to @post, notice: 'Post was successfully created.' }
        format.json { render :show, status: :created, location: @post }
      else
        format.html { render :new }
        format.json { render json: @post.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /posts/1
  # PATCH/PUT /posts/1.json
  def update
    respond_to do |format|
      if @post.update(post_params)
        format.html { redirect_to @post, notice: 'Post was successfully updated.' }
        format.json { render :show, status: :ok, location: @post }
      else
        format.html { render :edit }
        format.json { render json: @post.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /posts/1
  # DELETE /posts/1.json
  def destroy
    @post.destroy
    respond_to do |format|
      format.html { redirect_to posts_url, notice: 'Post was successfully destroyed.' }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_post
      @post = Post.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def post_params
        params.require(:post).permit(:title, :author, :body)
    end
end

任何帮助都会很棒!

后控制器

set ipv4Address to do shell script "ifconfig en0 | awk '/inet / {print $2}'"
set {TID, text item delimiters} to {text item delimiters, "."}
set thirdOctet to text item 3 of ipv4Address
set text item delimiters to TID

display dialog thirdOctet buttons {"OK"} default button "OK"

1 个答案:

答案 0 :(得分:1)

错误日志表示你的帖子控制器存在问题,

  

ActionController :: RoutingError(未初始化的常量   PostController中):

如果您可以使用帖子控制器更新您的问题,那么可能很容易获得帮助或自己查看,因为您可以修复它