Sha256: 87e0e534e41dc5c6fba2508cf27fd29f35609c40fcc2c685d2a159b5b2d3a213
Contents?: true
Size: 1.52 KB
Versions: 5
Compression:
Stored size: 1.52 KB
Contents
Description: The extension_model generator creates stubs for a new model for an extension. The generator takes the extension name and a model name as its arguments. The model name may be given in CamelCase or under_score and should not be suffixed with 'Model'. As additional parameters, the generator will take attribute pairs described by name and type. These attributes will be used to prepopulate the migration to create the table for the model and give you a set of predefined fixtures. You don't have to think up all attributes up front, but it's a good idea of adding just the baseline of what's needed to start really working with the resource. The generator creates a model class in vendor/extensions/extension_name/app/models, a test suite in vendor/extensions/extension_name/test/unit, test fixtures in vendor/extensions/extension_name/test/fixtures/singular_name.yml, and a migration in vendor/extensions/extension_name/db/migrate. Examples: ./script/generate extension_model MyExt account This will create an Account model: Model: vendor/extensions/my_ext/app/models/account.rb Test: vendor/extensions/my_ext/test/unit/account_test.rb Fixtures: vendor/extensions/my_ext/test/fixtures/accounts.yml Migration: vendor/extensions/my_ext/db/migrate/XXX_add_accounts.rb ./script/generate extension_model MyExt post title:string body:text Creates post model with predefined attributes.
Version data entries
5 entries across 5 versions & 1 rubygems