lib/rails/graphql/alternative/query.rb in rails-graphql-1.0.1 vs lib/rails/graphql/alternative/query.rb in rails-graphql-1.0.2
- old
+ new
@@ -50,10 +50,10 @@
# Create a new field for the class
def define_field(field_name = nil, type = :any, **xargs, &block)
field_name ||= anonymous? ? '_anonymous' : begin
type_module = type_field_class.to_s.classify.pluralize
- user_name = name.split(+"#{type_module}::")[1]
+ user_name = name.split(+"#{type_module}::")&.at(1)
user_name ||= name.delete_prefix('GraphQL::')
user_name.tr(':', '')
end
# Save the generated field ensuring the owner