Sha256: 8d79c2511b54dd8718aef79d76aac26668f35ae858510af85ec8e2f6f0d22ac6

Contents?: true

Size: 414 Bytes

Versions: 1

Compression:

Stored size: 414 Bytes

Contents

require 'active_record'

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

class Post < ActiveRecord::Base
  scope :on_position, -> { order(position: :asc) }
end

ActiveRecord::Schema.define do
  create_table :posts do |t|
    t.column :position, :indeger
  end
end

[2, 3, 1, 10, 9, 6, 5, 7, 8, 4].each_with_index do |position, index|
  Post.create!(position: position)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
record_neighbors-0.0.2.1 spec/support/test_database.rb