Class: ActiveForce::ModelGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/active_force/model/model_generator.rb

Defined Under Namespace

Classes: Attribute

Constant Summary collapse

SALESFORCE_TO_ACTIVEMODEL_TYPE_MAP =
{
  'boolean' => :boolean,
  'double' => :float,
  'percentage' => :float,
  'currency' => :decimal,
  'date' => :date,
  'datetime' => :datetime,
  'int' => :integer,
}

Instance Method Summary collapse

Instance Method Details

#create_model_fileObject



18
19
20
21
22
# File 'lib/generators/active_force/model/model_generator.rb', line 18

def create_model_file
  @table_name = name
  @class_name = prepare_namespace + @table_name.gsub('__c', '')
  template "model.rb.erb", "app/models/#{@class_name.underscore}.rb" if table_exists?
end