Module: Roomer::Helpers::GeneratorHelper
- Included in:
- Generators::MigrationGenerator, Generators::ModelGenerator
- Defined in:
- lib/roomer/helpers/generator_helper.rb
Instance Method Summary collapse
-
#migration_dir ⇒ Object
Fetchs the migration directory for the migrations.
-
#model_exists? ⇒ True, False
Check to see if the model file exists, should be used in a Generator.
-
#model_path ⇒ String
Returns the path of the model.
-
#shared? ⇒ True, False
Reads the –shared option specified when running “rails generate roomer:model”.
Instance Method Details
#migration_dir ⇒ Object
Fetchs the migration directory for the migrations
24 25 26 27 |
# File 'lib/roomer/helpers/generator_helper.rb', line 24 def migration_dir return Roomer.shared_migrations_directory if shared? return Roomer.tenanted_migrations_directory end |
#model_exists? ⇒ True, False
Check to see if the model file exists, should be used in a Generator
7 8 9 |
# File 'lib/roomer/helpers/generator_helper.rb', line 7 def model_exists? File.exists?(File.join(destination_root, model_path)) end |
#model_path ⇒ String
Returns the path of the model
13 14 15 |
# File 'lib/roomer/helpers/generator_helper.rb', line 13 def model_path @model_path ||= File.join("app", "models", "#{file_path}.rb") end |
#shared? ⇒ True, False
Reads the –shared option specified when running “rails generate roomer:model”
19 20 21 |
# File 'lib/roomer/helpers/generator_helper.rb', line 19 def shared? @shared ||= [:shared] end |