Ruby on rails 导轨:回形针宝石触发器;必须使用访问令牌……”;渲染图像时

Ruby on rails 导轨:回形针宝石触发器;必须使用访问令牌……”;渲染图像时,ruby-on-rails,ruby,paperclip,Ruby On Rails,Ruby,Paperclip,我在尝试使用回形针gem在Rails视图中显示图像时遇到了一个持续的问题。每当我尝试使用呈现存储在数据库中的图像时,allI get都会显示消息“Graph返回错误。必须使用活动访问令牌查询有关当前用户的信息” 必须注意三件事: 1) 我是RubyonRails中的一个noob。 2) 我没有在我的应用程序中实现任何用户模型或访问令牌要求。 3) 所有其他数据在视图中都呈现得很好,显然,包括图像在内的所有数据都正确地传递到了数据库中 控制器: class EventsController <

我在尝试使用回形针gem在Rails视图中显示图像时遇到了一个持续的问题。每当我尝试使用
呈现存储在数据库中的图像时,allI get都会显示消息“Graph返回错误。必须使用活动访问令牌查询有关当前用户的信息”

必须注意三件事: 1) 我是RubyonRails中的一个noob。 2) 我没有在我的应用程序中实现任何用户模型或访问令牌要求。 3) 所有其他数据在视图中都呈现得很好,显然,包括图像在内的所有数据都正确地传递到了数据库中

控制器:

class EventsController < ApplicationController
  before_action :set_event, only: [:show, :edit, :update, :destroy]

  # GET /events
  # GET /events.json
  def index
    @events = Event.all
  end

  # GET /events/1
  # GET /events/1.json
  def show
    @event = Event.find(params[:id])
  end

  # GET /events/new
  def new
    @event = Event.new
  end

  # GET /events/1/edit
  def edit
  end

  # POST /events
  # POST /events.json
  def create
    @event = Event.new(event_params)

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

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

  # DELETE /events/1
  # DELETE /events/1.json
  def destroy
    @event.destroy
    respond_to do |format|
      format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }
      format.json { head :no_content }
    end
  end

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

    # Never trust parameters from the scary internet, only allow the white list through.
    def event_params
      params.require(:event).permit(:title, :date, :address, :cost, :image, :description)
    end
end
类事件控制器
事件模型:

class Event < ActiveRecord::Base
  has_attached_file :image, styles: { medium: "300x300>", thumb: "100x100>" }#, default_url: "/images/:style/missing.png"
  validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
end
class事件”,thumb:“100x100>”},默认url:“/images/:style/missing.png”
验证附件内容类型:图像、内容类型:/\Aimage\/.\Z/
终止
“显示”视图:

<p id="notice"><%= notice %></p>


<%= image_tag @event.image.url %>


<p>
  <strong>Title:</strong>
  <%= @event.title %>
</p>

<p>
  <strong>Date:</strong>
  <%= @event.date %>
</p>

<p>
  <strong>Address:</strong>
  <%= @event.address %>
</p>

<p>
  <strong>Cost:</strong>
  <%= @event.cost %>
</p>

<p>
  <strong>Image:</strong>
  <%= image_tag @event.image.url %>
</p>

<p>
  <strong>Description:</strong>
  <%= @event.description %>
</p>

<%= link_to 'Edit', edit_event_path(@event) %> |
<%= link_to 'Back', events_path %>

标题:

日期:

地址:

成本:

图像:

说明:

|

我真的很感谢你的帮助,因为我已经被这个问题困扰了几天了

看起来你的Facebook访问令牌有问题。当搜索返回错误的
图形时,您会发现几个类似的问题和答案。必须使用活动访问令牌在Google上查询有关当前用户的信息。我建议检查你的Facebook和社交工具配置。谢谢你的回复@spickermann,但我没有任何社交工具配置,因为我的应用程序中根本没有使用它们。正如我提到的,我甚至没有用户模型!我之所以发布这个问题,正是因为我通过谷歌搜索发现的都是Facebook的问题,而我现在并没有使用它。