module Proxied::Generators::OrmHelpers

Private Instance Methods

inject_after_pattern(orm = :active_record) click to toggle source
# File lib/generators/proxied/orm_helpers.rb, line 9
def inject_after_pattern(orm = :active_record)
  if orm == :active_record
    /class #{table_name.camelize}\n|class #{table_name.camelize} .*\n|class #{table_name.demodulize.camelize}\n|class #{table_name.demodulize.camelize} .*\n/
  else
    /include Mongoid::Document\n|include Mongoid::Document .*\n/
  end
end
migration_path() click to toggle source
# File lib/generators/proxied/orm_helpers.rb, line 21
def migration_path
  if Rails.version >= '5.0.3'
    db_migrate_path
  else
    @migration_path ||= File.join("db", "migrate")
  end
end
model_exists?() click to toggle source
# File lib/generators/proxied/orm_helpers.rb, line 17
def model_exists?
  File.exist?(File.join(destination_root, model_path))
end
model_path() click to toggle source
# File lib/generators/proxied/orm_helpers.rb, line 29
def model_path
  @model_path ||= File.join("app", "models", "#{file_path}.rb")
end