Class: VoteFu::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- VoteFu::Generators::InstallGenerator
- Includes:
- ActiveRecord::Generators::Migration
- Defined in:
- lib/generators/vote_fu/install/install_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_initializer ⇒ Object
15 16 17 |
# File 'lib/generators/vote_fu/install/install_generator.rb', line 15 def create_initializer template "initializer.rb", "config/initializers/vote_fu.rb" end |
#create_migration ⇒ Object
19 20 21 22 23 24 |
# File 'lib/generators/vote_fu/install/install_generator.rb', line 19 def create_migration migration_template( "migration.rb.erb", "db/migrate/create_vote_fu_votes.rb" ) end |
#show_post_install_message ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/generators/vote_fu/install/install_generator.rb', line 26 def say "" say "VoteFu installed successfully!", :green say "" say "Next steps:" say " 1. Run migrations: rails db:migrate" say " 2. Add to your models:" say "" say " class Post < ApplicationRecord" say " acts_as_voteable" say " end" say "" say " class User < ApplicationRecord" say " acts_as_voter" say " end" say "" say " 3. Start voting:" say " user.upvote(post)" say " user.downvote(post)" say " post.plusminus" say "" end |