Sha256: 022a13b520ecc8e36b5672062dc759c3c8b15ab380a82506be2e745b573f36bc

Contents?: true

Size: 621 Bytes

Versions: 6

Compression:

Stored size: 621 Bytes

Contents

# connect
ActiveRecord::Base.establish_connection(
  :adapter => "sqlite3",
  :database => ":memory:"
)

# create model
ActiveRecord::Schema.define(:version => 1) do
  create_table :users do |t|
    t.string :full_name
    t.string :name
  end

  create_table :authors do |t|
    t.string :name
  end

  create_table :posts do |t|
    t.integer :author_id
  end
end

class User < ActiveRecord::Base
end

# do not reuse user, since it is used in controller tests!
class Author < ActiveRecord::Base
  find_by_autocomplete :name
end

class Post < ActiveRecord::Base
  belongs_to :author
  autocomplete_for :author, :name
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
simple_autocomplete-0.3.5 spec/setup_test_model.rb
simple_autocomplete-0.3.4 spec/setup_test_model.rb
simple_autocomplete-0.3.3 spec/setup_test_model.rb
simple_autocomplete-0.3.2 spec/setup_test_model.rb
simple_autocomplete-0.3.1 spec/setup_test_model.rb
simple_autocomplete-0.3.0 spec/setup_test_model.rb