Module: ModelProbe
- Includes:
- Probes
- Defined in:
- lib/model_probe.rb,
lib/model_probe/version.rb,
lib/model_probe/railtie.rb
Defined Under Namespace
Modules: Probes Classes: Railtie
Constant Summary collapse
- VERSION =
"1.1.3"
Instance Method Summary collapse
-
#print_fixture ⇒ Object
Prints a stub that can be used for a test fixture.
-
#print_model ⇒ Object
Prints a new model definition based on the database schema.
Methods included from Probes
Methods included from Probes::Subclasses
Methods included from Probes::Indexes
Methods included from Probes::Columns
Methods included from Probes::Metadata
Instance Method Details
#print_fixture ⇒ Object
Prints a stub that can be used for a test fixture
13 14 15 16 17 |
# File 'lib/model_probe.rb', line 13 def print_fixture template = erb_template("model_probe/templates/fixture.yml.erb") puts template.result_with_hash(name: name, fixture_columns: fixture_columns) nil end |
#print_model ⇒ Object
Prints a new model definition based on the database schema
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/model_probe.rb', line 20 def print_model template = erb_template("model_probe/templates/model.rb.erb") puts template.result_with_hash( name: name, superclass_name: superclass.name, primary_key_columns: primary_key_columns, foreign_key_columns: foreign_key_columns, relation_columns: relation_columns, required_columns: required_columns, limit_columns: limit_columns, validation_columns: validation_columns ) nil end |