class Paysto::ModelsGenerator
Public Class Methods
next_migration_number(dirname)
click to toggle source
Migration timestamp.
# File lib/generators/paysto/models_generator.rb, line 10 def self.next_migration_number(dirname) if ActiveRecord::Base.timestamped_migrations Time.new.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end
Public Instance Methods
copy_models()
click to toggle source
Render configured models.
# File lib/generators/paysto/models_generator.rb, line 24 def copy_models template 'models/payment.rb', "app/models/#{Paysto.payment_class_name.underscore}.rb" template 'models/invoice.rb', "app/models/#{Paysto.invoice_class_name.underscore}.rb" template 'models/invoice_notification.rb', "app/models/#{Paysto.invoice_notification_class_name.underscore}.rb" end
create_migration_file()
click to toggle source
Create migration with required tables.
# File lib/generators/paysto/models_generator.rb, line 19 def create_migration_file migration_template 'migration.rb', 'db/migrate/create_paysto_tables.rb' end