我在这个地方已经有一段时间了,并且遇到了失败的长城......
我正在尝试从 Mochi Media 的服务器中提取一些游戏信息。我有 API 挂钩,但是当我尝试使用 Dragonfly 访问文件信息时,出现以下错误:
undefined method `file_uid' for #<Game:0x007fba5e0bf188>
谁能看到我在做什么奇怪的事情?
模型:
class Game < ActiveRecord::Base
attr_accessible :description, :name, :file, :image
image_accessor :image
image_accessor :file
validates :name, uniqueness: true
validates :name, presence: true
end
类: def move(游戏)
# Grab the mochi game from the queue
mochi_game = Mochi.find(game.id)
if mochi_game
# Setup a new game object
game = Game.new
# Pull the game's name
game.name = mochi_game.name
# Pull the thumb & game file
game.image_url = mochi_game.image_url
game.file_url = mochi_game.file_url
# Pull the metadata
game.description = mochi_game.description
# Save the game to our db
game.save
end
return false
end
移民:
class AddImageAndGametoGames < ActiveRecord::Migration
def up
add_column :games, :image_uid, :string
add_column :games, :file_uid, :string
end
def down
remove_column :games, :image_uid, :string
remove_column :games, :file_uid, :string
end
end