Sha256: 9fd726c1ba6966186a5df22b903d4f85d5622d8a6960fcdd390848aef117dca4

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

class Actor < ActiveRecord::Base
  belongs_to :movie
end

class Movie < ActiveRecord::Base
  def display_name
    "Movie: #{name}"
  end
end

class ActorsController < ActionController::Base
  autocomplete :movie, :name                       
end        

module Rails3JQueryAutocomplete
  module Test
    module ActiveRecord
      def setup
        ::ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
        ::ActiveRecord::Schema.define(:version => 1) do
          create_table :movies do |t|
            t.column :name, :string
          end

          create_table :actors do |t|
            t.column :movie_id, :integer
            t.column :name, :string
          end
        end

        @movie  = Movie.create(:name => 'Alpha')
        @movie2 = Movie.create(:name => 'Alspha')
        @movie3 = Movie.create(:name => 'Alzpha')
      end

      def teardown
        ::ActiveRecord::Base.connection.tables.each do |table|
          ::ActiveRecord::Base.connection.drop_table(table)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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