Skip to content

Commit

Permalink
Update Relation to subclass Memory::Relation
Browse files Browse the repository at this point in the history
Recent changes to `ROM::Memory::Relation` made it possible to use it as
the superclass for adapter relations. This adds schema support among
other things.
  • Loading branch information
elskwid committed Mar 6, 2017
1 parent ebc0474 commit 1ce8948
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/rom/csv/relation.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'rom/relation'
require 'rom/memory'

module ROM
module CSV
Expand All @@ -9,11 +9,9 @@ module CSV
# end
#
# @api public
class Relation < ROM::Relation
class Relation < ROM::Memory::Relation
adapter :csv

forward :join, :project, :restrict, :order

def count
dataset.count
end
Expand Down
6 changes: 6 additions & 0 deletions spec/integration/gateway_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
configuration.relation(:users) do
gateway :users

schema(:users) do
attribute :user_id, Types::Strict::Int
attribute :name, Types::Strict::String
attribute :email, Types::Strict::String
end

def by_name(name)
restrict(name: name)
end
Expand Down

0 comments on commit 1ce8948

Please sign in to comment.