Class: IosPushNotificationsGenerator

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

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object

FIXME: Should be proxied to ActiveRecord::Generators::Base Implement the required interface for Rails::Generators::Migration.



22
23
24
25
26
27
28
# File 'lib/generators/ios_push_notifications_generator.rb', line 22

def self.next_migration_number(dirname) #:nodoc:
  if ActiveRecord::Base.timestamped_migrations
    Time.now.utc.strftime("%Y%m%d%H%M#{rand 60}")
  else
    "%.3d" % (current_migration_number(dirname) + 1)
  end
end

Instance Method Details

#create_initializerObject



9
10
11
# File 'lib/generators/ios_push_notifications_generator.rb', line 9

def create_initializer
  template 'initializer.rb', "config/initializers/ios_push_notification.rb"
end

#create_migrationObject



13
14
15
16
# File 'lib/generators/ios_push_notifications_generator.rb', line 13

def create_migration
  migration_template 'device_migration.rb', "db/migrate/create_iospn_devices.rb" 
  migration_template 'notification_migration.rb', "db/migrate/create_iospn_notifications.rb" 
end