lib/generators/schemable/model_generator.rb in schemable-0.1.2 vs lib/generators/schemable/model_generator.rb in schemable-0.1.3

- old
+ new

@@ -2,12 +2,12 @@ class ModelGenerator < Rails::Generators::Base source_root File.expand_path('../../templates', __dir__) class_option :model_name, type: :string, default: 'Model', desc: 'Name of the model' - def initialize(*) - super(*) + def initialize(*args) + super(*args) @model_name = options[:model_name] @model_name != 'Model' || raise('Model name is required') end @@ -34,11 +34,15 @@ def serializer V1::#{@model_name.classify}Serializer end - def excluded_request_attributes - %i[id updatedAt createdAt] + def excluded_create_request_attributes + %i[updated_at created_at] + end + + def excluded_update_request_attributes + %i[updated_at created_at] end end end end FILE