Class: Headshot::Generators::GenerateGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Headshot::Generators::GenerateGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/headshot/generate/generate_generator.rb
Class Method Summary collapse
-
.next_migration_number(path) ⇒ Object
Copied migration template generator from stackoverflow.com/questions/4141739/generators-and-migrations-in-plugins-rails-3.
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
Copied migration template generator from stackoverflow.com/questions/4141739/generators-and-migrations-in-plugins-rails-3
12 13 14 |
# File 'lib/generators/headshot/generate/generate_generator.rb', line 12 def self.next_migration_number(path) Time.now.utc.strftime("%Y%m%d%H%M%S") end |
Instance Method Details
#add_headshot_routes ⇒ Object
16 17 18 |
# File 'lib/generators/headshot/generate/generate_generator.rb', line 16 def add_headshot_routes route %{post "headshot/capture" => 'headshot#capture', :as => :headshot_capture} end |
#create_model_file ⇒ Object
20 21 22 23 |
# File 'lib/generators/headshot/generate/generate_generator.rb', line 20 def create_model_file template "lib/app/models/headshot_photo.rb", "app/models/headshot_photo.rb" migration_template "lib/db/migrate/create_headshot_photos.rb", "db/migrate/create_headshot_photos.rb" end |