Class: GraphqlMutationsGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/graphql_mutations/graphql_mutations_generator.rb

Instance Method Summary collapse

Instance Method Details

#generateObject



3
4
5
6
7
8
9
10
11
# File 'lib/generators/graphql_mutations/graphql_mutations_generator.rb', line 3

def generate
  @id = Graphql::Rails::Api::Config.instance.id_type == :uuid ? '!types.String' : '!types.ID'
  resource = file_name.underscore.singularize
  dir = "app/graphql/#{resource.pluralize}/mutations"
  system("mkdir -p #{dir}")
  generate_create_mutation(dir, resource)
  generate_update_mutation(dir, resource)
  generate_destroy_mutation(dir, resource)
end