Class: Gql::InputGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
GqlGeneratorBase
Defined in:
lib/generators/gql/input_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate_input_typeObject



8
9
10
11
12
13
14
15
# File 'lib/generators/gql/input_generator.rb', line 8

def generate_input_type
  file_name = model_name

  ignore = ['id', 'created_at', 'updated_at']
  @fields = map_model_types(model_name).reject { |field| ignore.include?(field[:name]) }

  template('input_type.rb', "app/graphql/types/input/#{file_name.underscore}_input.rb")
end