Sha256: ca545007bec808b64aed8cb58336efd7d83df42057db9359058e09e95b19bc45
Contents?: true
Size: 1.68 KB
Versions: 252
Compression:
Stored size: 1.68 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 Migration: vendor/extensions/my_ext/db/migrate/XXX_add_accounts.rb Spec: vendor/extensions/my_ext/spec/models/account_spec.rb Test: vendor/extensions/my_ext/test/unit/account_test.rb (if extension created with "--with-test-unit") Fixtures: vendor/extensions/my_ext/test/fixtures/accounts.yml (if extension created with "--with-test-unit") ./script/generate extension_model MyExt post title:string body:text Creates post model with predefined attributes.
Version data entries
252 entries across 251 versions & 9 rubygems