Class: RatemeGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/rateme/rateme_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



18
19
20
# File 'lib/generators/rateme/rateme_generator.rb', line 18

def self.next_migration_number(path)
  ActiveRecord::Generators::Base.next_migration_number(path)
end

Instance Method Details

#generate_layoutObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/generators/rateme/rateme_generator.rb', line 22

def generate_layout
  template "model.rb", 
    "app/models/rating.rb"

  if options.migration?
    migration_template "migration.rb", 
      "db/migrate/create_ratings.rb"
  end

  if options.stylesheet?
    copy_file "stylesheet.css",
      "public/stylesheets/rateme.css"

    copy_file "javascript.js", 
      "public/javascripts/rateme.js"

    copy_file "stars.gif", 
      "public/images/stars.gif"

    copy_file "spinner.gif", 
      "public/images/spinner.gif"
  end
end