Tag: Ruby On Rails
-
How to make Rails app with Graphql to take “name” and “repos” from api.github?
-1 A form in which you need to enter GitHub_login, after processing the form, display the github name and the list of repos. Example: Enter: dhh Output: David Heinemeier Hansson actioncable asset-hosting-with-minimum-ss1 bundler The server should process requests using GraphQL (https://github.com/rmosolgo/graphql-ruby). It should pull data from GitHub and process it. To get data from GitHub,…
-
What’s the advantages of pre-fetching the GraphQL schema when we can manually pass data to request body?
0 Foreword: I am completely new to GraphQL so I am just trying to figure out what is the best practice when working with it So I need to call a GraphQL API written in Nestjs (more specifically, from a Rails server). There is this nice gem graphql-client that makes a Client to communicate with…
-
Rails GraphQL query on nested type
0 I have a rails app and I use gem GraphQL. The app contain this type in: app/graphql/types/category_type.rb module Types class CategoryType < Types::BaseObject field :id, ID, null: false field :name, String, null: false field :weight, Integer, null: false field :parent_id, Integer field :categories, [Types::CategoryType] field :shoes, [Types::ShoeType] def categories object.categories.all end def shoes() object.shoes.all…
-
How to examine and change actions on commercetools updateCart query?
0 My question is this: Is there a feature or method within graphql that allows editing of incoming queries EASILY so that I can prevent an action from being performed? I would like to examine my query in a web proxy, edit the actions, and then send it on to its destination. Context: I have…
-
Rails graphql-batch: Dependent fields that use loaders
0 I have a Rails 7 GraphQL API, and I’m using the graphql-batch custom loaders to handle some n+1 query issues. In my GraphQL type definition, I have two fields, has_upcoming_schedule and has_available_spot. I want to modify the has_available_spot field so that it returns nil unless there are upcoming schedules. Only if the program has…
-
undefined method `ids’ for [#
0 def resolve(where: {}, order_by: {‘field’: ‘updated_at’, ‘direction’: ‘desc’}) order_by.symbolize_keys! [context[:current_user]] unless context[:current_user].has_capability?(self.class.name.demodulize) cap_belongs_to = context[:current_user].determine_capability_belongs_to(self.class.name.demodulize) users = if cap_belongs_to[:direct] || context[:current_user].user_type == ‘SuperAdmin’ context[:tenant].users.includes([:groups, :roles]).where(where).order("#{order_by[:field]} #{order_by[:direction]}") elsif cap_belongs_to[:group].present? context[:tenant].groups.where(cap_belongs_to[‘group’]).map(&:users).flatten else [context[:current_user]] end stored_user_contents = (UserContent.select("DISTINCT ON (user_id) user_contents.*")) users.to_a missing_user_content_ids = users.ids – stored_user_contents.pluck(:user_id) missing_user_contents = missing_user_content_ids.map do |user_id| UserContent.new(user_id: user_id, on_fly: true) end…
-
Does Ruby on Rails nullify session in Graphql Controller from outside domains?
0 I have a Rails + graphql service running on a different domain, but it seems the session variable in graphql_controller.rb is nil. When I run my service locally, the session and context works as expected. Here’s an example: # in graphql controller def execute context = { session: session, test_variable: "has access" } result…
-
Graphql mutation error: “Field ‘createUser’ is missing required arguments: input”
7 I’m trying to follow along this article on how to create a mutation on a rails server using GraphQl https://www.howtographql.com/graphql-ruby/4-authentication However, I’m stuck at the CreateUser Mutation step, I get the follow error hash when trying it out in GraphiQL: { “errors”: [ { “message”: “Field ‘createUser’ is missing required arguments: input”, “locations”: […