Question

I have been at this one for a while and hitting a great wall of fail...

I'm trying to pull some game info from Mochi Media's servers. I have the API hooks in place but when I try to access the file info with Dragonfly I'm getting the following error:

undefined method `file_uid' for #<Game:0x007fba5e0bf188>

Can anyone see anything weird that I'm doing?

Model:

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

Class: def move(game)

    # 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

Migration:

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
Was it helpful?

Solution

Looks like once again, in pure Ruby/Rails newbie fashion, I managed to get this wrong. The issue was stemming from a few crazy issues with my DB schema. Once I worked all that out and re-installed the plugin based on an older GIT commit I was able to get this gem up and running.

Hopefully, in some odd way, this helps another SO user who may be interested in trying this Gem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top