123456789_123456789_123456789_123456789_123456789_

Class: Rails::Generators::GeneratedAttribute

Relationships & Source Files
Inherits: Object
Defined in: lib/rails/generators/mongoid_generator.rb

Overview

Extension to Rails’ GeneratedAttribute class.

Instance Method Summary

Instance Method Details

#type_classString

Returns the ::Rails::Mongoid attribute type value for a given input class type.

Returns:

  • (String)

    The type value.

[ GitHub ]

  
# File 'lib/rails/generators/mongoid_generator.rb', line 29

def type_class
  return 'Time' if type == :datetime
  return 'String' if type == :text
  return 'Mongoid::Boolean' if type == :boolean

  type.to_s.camelcase
end