Class: Monocle::Generators::ViewGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Monocle::Generators::ViewGenerator
- Defined in:
- lib/monocle/generators/view_generator.rb
Instance Method Summary collapse
Instance Method Details
#generate_model_file ⇒ Object
19 20 21 22 23 24 |
# File 'lib/monocle/generators/view_generator.rb', line 19 def generate_model_file # Don't do anything if we're skipping this return if [:skip_model] # Invoke rails' nifty model generator for us invoke "model", [file_path.singularize], .merge(migration: false, test_framework: false) end |
#generate_sql_file ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/monocle/generators/view_generator.rb', line 8 def generate_sql_file create_file "db/views/#{file_name}.sql" do <<-EOF -- Timestamp: #{Time.now} CREATE OR REPLACE VIEW #{file_name} AS -- Add your stuff here ; EOF end end |