Sha256: 257d76edd5db2aa957566ac60a5f92035f0142643d05d1de32889822891b87f5

Contents?: true

Size: 527 Bytes

Versions: 1

Compression:

Stored size: 527 Bytes

Contents

class AuditModelGenerator < Rails::Generator::NamedBase
  def initialize(runtime_args, runtime_options = {})
    runtime_args << 'user' if runtime_args.empty?
    super
    @human_model = runtime_args[0] ? runtime_args[0].underscore : 'user'
  end

  def manifest
    record do |m|
      m.directory(File.join('app', 'models'))
      m.template('model.rb', "app/models/audit.rb", :assigns => { :human_model => @human_model })
    end
  end

  protected

  def banner
    "Usage: #{$0} audit_model [human_model_name]"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_audited_customized-1.2.2 generators/audit_model/audit_model_generator.rb