Class: Napa::CLI::Model
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Napa::CLI::Model
- Includes:
- Thor::Actions
- Defined in:
- lib/napa/cli/model.rb
Overview
Note: This currently does not support namespaced model creation.
Instance Method Summary collapse
Instance Method Details
#generate_model ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/napa/cli/model.rb', line 33 def generate_model # In order to check for class collisions, the Grape environment needs to be loaded. say 'Generating model...' self.class.source_root "#{File.dirname(__FILE__)}/templates" create_migration_file create_model_file create_factory_file create_model_spec_file say 'Done!', :green end |
#parse_attributes! ⇒ Object
27 28 29 30 31 |
# File 'lib/napa/cli/model.rb', line 27 def parse_attributes! self.attributes = (attributes || []).map do |attr| GeneratedAttribute.parse(attr) end end |