Skip to content

Commit

Permalink
fix attributes arguments in relation computed attributes to be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
diegosenarruzza committed Oct 28, 2020
1 parent aed01e3 commit e36e67e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/rasti/db/computed_attributes/relation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module DB
module ComputedAttributes
class Relation

def initialize(value:, table:, type:, attributes:, foreign_key:)
def initialize(value:, table:, type:, foreign_key:, attributes: [])
@value = value
@table = table
@type = type
@attributes = attributes
@attributes = attributes.push foreign_key
@foreign_key = foreign_key
end

Expand Down
1 change: 0 additions & 1 deletion spec/minitest_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class Users < Rasti::DB::Collection
Rasti::DB::ComputedAttributes::Relation.new value: Sequel.function('count', :id),
table: db[:comments],
type: :inner,
attributes: [:user_id],
foreign_key: :user_id
end

Expand Down

0 comments on commit e36e67e

Please sign in to comment.