1
コントローラでメソッドを呼び出そうとするとエラーが発生します。チュートリアルの後、これをどのように動作させるかについては、ちょっとした泥の中に詰まっていて、助けが必要です。コントローラで未定義のメソッド
NoMethodError in CatalogController#index
undefined method `art' for #<Class:0x007fbe8c338310>
マイモデル
require 'httparty'
require 'json'
class Feed < ActiveRecord::Base
include HTTParty
base_uri 'https://www.parsehub.com/api/v2/runs'
# GET /feeds
# GET /feeds.json
def art
response = self.class.get("/tnZ4F47Do9a7QeDnI6_8EKea/data?&format=json")
@elements = response.parsed_response["image"]
@parsed = @elements.collect { |e| e['url'] }
end
end
私のコントローラ
class CatalogController < ApplicationController
def index
@images = Feed.art
end
end
私はそれは私が忘れてるかなり単純なものだ推測しています。