首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么这个rails文件附件没有加载(使用蜻蜓)?

为什么这个rails文件附件没有加载(使用蜻蜓)?
EN

Stack Overflow用户
提问于 2013-09-19 21:06:47
回答 1查看 706关注 0票数 0

我在这已经有一段时间了,撞上了一堵失败的长城.

我想从Mochi Media的服务器上提取一些游戏信息。我已经安装了API钩子,但是当我尝试使用Dragonfly访问文件信息时,我得到了以下错误:

代码语言:javascript
复制
undefined method `file_uid' for #<Game:0x007fba5e0bf188>

有人能看到我在做什么奇怪的事吗?

模型:

代码语言:javascript
复制
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移动(游戏)

代码语言:javascript
复制
    # 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

迁移:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-09-23 07:55:34

看起来又一次,以纯Ruby/Rails新手的方式,我成功地弄错了。这个问题源于我的DB模式中的一些疯狂的问题。一旦我完成了所有这些工作,并重新安装了基于一个较老的GIT提交插件,我就能够启动和运行这个创业板。

希望,在一些奇怪的方式,这有助于另一个这样的用户谁可能有兴趣尝试这个宝石。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18904929

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档