How to get current user's IP address inside QueryType? For example here:
class QueryType < GraphQL::Schema::Object
  description "The query root of this schema"
  field :post, PostType, "Find a post by ID" do
    argument :id, ID
  end
  def post(id:)
    # I need to get user's IP here
    Post.find(id)
  end
end
 
                        
You need to pass in a
contextto graphql.Here's an example:
Then,