Class: SawGenerator
- Inherits:
-
ActiveRecord::Generators::Base
- Object
- ActiveRecord::Generators::Base
- SawGenerator
- Includes:
- Rails::Generators::ResourceHelpers
- Defined in:
- lib/generators/saw/saw_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
11 12 13 |
# File 'lib/generators/saw/saw_generator.rb', line 11 def self.source_root @source_root ||= File.('../templates', __FILE__) end |
Instance Method Details
#generate_migration ⇒ Object
15 16 17 |
# File 'lib/generators/saw/saw_generator.rb', line 15 def generate_migration migration_template "saw_migration.rb.erb", "db/migrate/add_visits_and_hits" end |
#generate_routes ⇒ Object
19 20 21 |
# File 'lib/generators/saw/saw_generator.rb', line 19 def generate_routes route 'post "visits" => "visits#create", :defaults => { :format => "json"}' end |