tasks/thor/model.rb in praxis-2.0.pre.31 vs tasks/thor/model.rb in praxis-2.0.pre.32
- old
+ new
@@ -11,18 +11,20 @@
desc 'gmodel', 'Generates a skeleton model file under app/models for ActiveRecord or Sequel.'
argument :model_name, required: true
option :orm, required: false, default: 'activerecord', enum: %w[activerecord sequel]
def g
+ models_dir = 'app/models'
+ models_dir = PraxisGenerator.scaffold_config[:models_dir] if PraxisGenerator.scaffold_config[:models_dir]
# self.class.check_name(model_name)
template_file = \
if options[:orm] == 'activerecord'
'models/active_record.rb'
else
'models/sequel.rb'
end
puts "Generating Model for #{model_name}"
- template template_file, "app/models/#{model_name}.rb"
+ template template_file, "#{models_dir}/#{model_name}.rb"
nil
end
# Helper functions (which are available in the ERB contexts)
no_commands do
def model_class