Class: LayeredStackRails::ScaffoldGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- LayeredStackRails::ScaffoldGenerator
- Defined in:
- lib/generators/layered_stack_rails/scaffold_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_model_file ⇒ Object
21 22 23 |
# File 'lib/generators/layered_stack_rails/scaffold_generator.rb', line 21 def create_model_file template "active_record/model/model.erb", File.join("app/models", "#{model_name}.rb") end |
#execute ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/generators/layered_stack_rails/scaffold_generator.rb', line 9 def execute yaml_content = YAML.load_file(File.join("app.yml")) model_data = yaml_content["resources"][model_name] if model_data puts "Generating model #{model_name} with attributes: #{model_data["attributes"]}" generate_scaffold(model_name, model_data["attributes"], model_data["associations"]) else puts "Model #{model_name} not found in app.yml" end end |