Class: Headshot::Generators::GenerateGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/headshot/generate/generate_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



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_routesObject



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_fileObject



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