Sha256: fe10c1199e3abf389fbf2a4faa99c1c3b84315ced4b7ff82600625942587fe2d

Contents?: true

Size: 947 Bytes

Versions: 2

Compression:

Stored size: 947 Bytes

Contents

class Character
  include Mongoid::Document
  field :name, :class => String
  referenced_in :game
end

class Game
  include Mongoid::Document
  field :name, :class => String
  references_one :character
  def display_name
    "Game: #{name}"
  end
end

class GamesController < ActionController::Base
  autocomplete :game, :name                       
end        

module Rails3JQueryAutocomplete
  module Test
    module Mongoid
      def setup
        ::Mongoid.configure do |config|
          name = "rails3_jquery_autocomplete_test"
          host = "localhost"
          config.master = Mongo::Connection.new.db(name)
          config.logger = nil
        end

        @game = Game.create(:name => 'Alpha')
        @game2 = Game.create(:name => 'Alspha')
        @game3 = Game.create(:name => 'Alzpha')
      end

      def teardown
        ::Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails3-jquery-autocomplete-0.5.0 test/support/mongoid.rb
rails3-jquery-autocomplete-0.4.0 test/support/mongoid.rb