Sha256: 4b3fe8b2b26244c3c3afbb893d8e4ee905ad76a9354b229a1cd78d417c5edcf5

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

ActiveRecord::Base.establish_connection(
  :adapter => defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' ? 'jdbcsqlite3' : 'sqlite3',
  :database => File.join(File.dirname(__FILE__), 'test.db')
)

class CreateSchema < ActiveRecord::Migration
  def self.up
    create_table :users, :force => true do |t|
      t.string :first_name
      t.string :last_name
      t.timestamps
    end
  end
end

CreateSchema.suppress_messages do
  CreateSchema.migrate(:up)
end

class User < ActiveRecord::Base
  def name
    [first_name, last_name].compact.join(' ')
  end

  def name=(names)
    self.first_name, self.last_name = names.split(' ', 2)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cache_flow-0.1.1 test/schema.rb
cache_flow-0.1.0 test/schema.rb