Class: HasFriends::Generators::FriendsCounter

Inherits:
Thor::Group
  • Object
show all
Includes:
Rails::Generators::Migration, Thor::Actions
Defined in:
lib/has_friends/generators/friends_counter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



18
19
20
# File 'lib/has_friends/generators/friends_counter.rb', line 18

def self.next_migration_number(path)
  Time.new.utc.strftime("%Y%m%d%H%M%S")
end

.source_rootObject



14
15
16
# File 'lib/has_friends/generators/friends_counter.rb', line 14

def self.source_root
  @source_root ||= File.dirname(__FILE__) + "/templates"
end

Instance Method Details

#create_migration_fileObject



22
23
24
25
# File 'lib/has_friends/generators/friends_counter.rb', line 22

def create_migration_file
  migration_template "add_friends_counter.rb", 
                      File.join('db','migrate', "add_friends_count_to_#{tableName.downcase}.rb")
end