Module: PaypalPermissions::Generators::OrmHelpers

Included in:
ActiveRecord::Generators::PaypalPermissionsGenerator
Defined in:
lib/generators/paypal_permissions/orm_helpers.rb

Instance Method Summary collapse

Instance Method Details

#migration_exists?(table_name) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/generators/paypal_permissions/orm_helpers.rb', line 13

def migration_exists?(table_name)
  Dir.glob("#{File.join(destination_root, migration_path)}/[0-9]*_*.rb").grep(/\d+_add_paypal_permissions_to_#{table_name}.rb$/).first
end

#migration_pathObject



17
18
19
# File 'lib/generators/paypal_permissions/orm_helpers.rb', line 17

def migration_path
  @migration_path ||= File.join("db", "migrate")
end

#model_contentsObject



4
5
6
7
# File 'lib/generators/paypal_permissions/orm_helpers.rb', line 4

def model_contents
<<-CONTENT
CONTENT
end

#model_exists?Boolean

Returns:

  • (Boolean)


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

def model_exists?
  File.exists?(File.join(destination_root, model_path))
end

#model_pathObject



21
22
23
# File 'lib/generators/paypal_permissions/orm_helpers.rb', line 21

def model_path
  @model_path ||= File.join("app", "models", "#{file_path}.rb")
end