Skip to content

Commit

Permalink
List votes when querying Links
Browse files Browse the repository at this point in the history
  • Loading branch information
pgaspar committed Aug 5, 2017
1 parent ff482bb commit 0688727
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/graphql/types/link_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
field :url, !types.String
field :description, !types.String
field :postedBy, -> { Types::UserType }, property: :user
field :votes, -> { !types[Types::VoteType] }
end
1 change: 1 addition & 0 deletions app/models/link.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class Link < ApplicationRecord
belongs_to :user
has_many :votes
end
1 change: 1 addition & 0 deletions test/graphql/resolvers/create_link_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ def perform(args = {})
assert_equal link.description, 'description'
assert_equal link.url, 'http://example.com'
assert_equal link.user, @user
assert_equal link.votes, []
end
end

0 comments on commit 0688727

Please sign in to comment.