Sha256: ea7283c8c8f5362083f1992de9e22818baa353f4c7af2bfcdd193406b8ab8ddb
Contents?: true
Size: 876 Bytes
Versions: 6
Compression:
Stored size: 876 Bytes
Contents
class MongoAttribute attr_accessor :name, :type def initialize(name, type) @name, @type = name, type end def type case @name when 'many' @type.tableize when 'index', 'belongs_to' @type.downcase else @type.capitalize end end def default_for_factory @default ||= case @type.downcase.to_sym when :integer then "{ 1 }" when :float then "{ 1.5 }" when :decimal then "{ 9.99 }" when :datetime, :timestamp, :time then "{ Time.now.to_s(:db) }" when :date then "{ Date.today.to_s(:db) }" when :string then "{ 'string' }" when :text then "{ 'text' }" when :boolean then "{ false }" else "" end end end
Version data entries
6 entries across 6 versions & 1 rubygems