Sha256: a87d9d68c6207683b2d1fb04516f31c7833aafb4e89553a1e633223c3ae2fe1f

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

class Pet < ActiveRecord::Base
end

class Enemy < ActiveRecord::Base
  acts_as_tokenizable :token
end

class Friend < ActiveRecord::Base
  acts_as_tokenizable :token

  def to_token
    string_to_token = [name, age].join(' ')
    ActsAsTokenizable::StringUtils.words_to_token(string_to_token)
  end
end

class City < ActiveRecord::Base
  acts_as_tokenizable :tokenized_name

  def to_token
    ActsAsTokenizable::StringUtils.words_to_token(name)
  end
end

ActiveRecord::Base.establish_connection(
  adapter: 'sqlite3',
  database: ':memory:'
)

ActiveRecord::Base.logger
ActiveRecord::Schema.define do
  self.verbose = false
end

ActiveRecord::Schema.define(version: 1) do
  create_table :pets do |t|
    t.column :name, :string
    t.column :owner, :string
  end
end

ActiveRecord::Schema.define(version: 2) do
  create_table :friends do |t|
    t.column :name, :string
    t.column :email, :string
    t.column :age, :integer
    t.column :token, :text
  end
end

ActiveRecord::Schema.define(version: 3) do
  create_table :cities do |t|
    t.column :name, :string
    t.column :tokenized_name, :text
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_tokenizable-0.9.0 spec/support_helper.rb