Sha256: da550b469b9241724230a2281c68a95864208c6da0ff075ecf34e49bf8c32a79

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

require "active_record"
require "shamu/entities/active_record"

module ActiveRecordSpec
  class Favorite < ::ActiveRecord::Base
    self.table_name = "favorites"
    extend ::Shamu::Entities::ActiveRecord
    include ::Shamu::Entities::ActiveRecordSoftDestroy

    scope :by_name, ->( name ) { where( name: name ) }
    scope :by_label, ->( label ) { where( label: label ) }
  end

  class FavoriteMigration < ::ActiveRecord::Migration
    def self.up
      create_table :favorites do |t|
        t.string :name
        t.string :label

        t.datetime :destroyed_at
      end
    end

    def self.down
      drop_table :favorites
    end
  end

  class FavoriteScope < Shamu::Entities::ListScope
    attribute :name
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shamu-0.0.13 spec/lib/shamu/active_record_support.rb