小编Bor*_*ris的帖子

文章#中的Recaptcha :: RecaptchaError显示没有指定网站密钥

我明白了:

"文章#中的Recaptcha :: RecaptchaError显示没有指定网站密钥."

我不明白我的错误在哪里.

的Gemfile:

gem 'dotenv-rails', :require => 'dotenv/rails-now'
gem "recaptcha", require: "recaptcha/rails"
Run Code Online (Sandbox Code Playgroud)

.ENV

export RECAPTCHA_PUBLIC_KEY = '*******************************'
export RECAPTCHA_PRIVATE_KEY = '*******************************'
Run Code Online (Sandbox Code Playgroud)

comments_controller.rb

class CommentsController < ApplicationController

    http_basic_authenticate_with name: "admin", password: "**************", only: :destroy

  def create
    @article = Article.find(params[:article_id])
    @comment = @article.comments.create(comment_params)
    redirect_to article_path(@article)
  end

  def destroy
    @article = Article.find(params[:article_id])
    @comment = @article.comments.find(params[:id])
    @comment.destroy
    redirect_to article_path(@article)
  end

  private
    def comment_params
      params.require(:comment).permit(:commenter, :body)
    end
end
Run Code Online (Sandbox Code Playgroud)

articles_controller.rb

class ArticlesController < ApplicationController

    http_basic_authenticate_with name: "admin", password: "**********", except: [:index, :show]

  def …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails

2
推荐指数
1
解决办法
2011
查看次数

标签 统计

ruby ×1

ruby-on-rails ×1