Class: ConversationsGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



10
11
12
13
# File 'lib/generators/conversations/conversations_generator.rb', line 10

def self.next_migration_number(dirname)
  next_migration_number = current_migration_number(dirname) + 1
  ActiveRecord::Migration.next_migration_number(next_migration_number)
end

.source_rootObject



6
7
8
# File 'lib/generators/conversations/conversations_generator.rb', line 6

def self.source_root
  @source_root ||= File.join(File.dirname(__FILE__), 'templates')
end

Instance Method Details

#create_migration_fileObject



15
16
17
18
19
# File 'lib/generators/conversations/conversations_generator.rb', line 15

def create_migration_file
  migration_template '20120105153739_create_conversations.rb', 'db/migrate/create_conversations.rb'
  migration_template '20120105153800_create_user_conversations.rb', 'db/migrate/create_user_conversations.rb'
  migration_template '20120105153812_create_messages.rb', 'db/migrate/create_messages.rb'
end