Sha256: 51643180ebf1a4171aa46604a57a26da28c887fa5da823c73217f6339aa4a18a

Contents?: true

Size: 437 Bytes

Versions: 2

Compression:

Stored size: 437 Bytes

Contents

require 'rails_admin/adapters/mongoid'

Paperclip.logger = Logger.new(nil)

class Tableless
  include Mongoid::Document

  class <<self
    def column(name, sql_type = 'string', default = nil, _null = true)
      # ignore length
      sql_type = sql_type.to_s.sub(/\(.*\)/, '').to_sym
      field(name, type: {integer: Integer, string: String, text: String, date: Date, datetime: DateTime}[sql_type], default: default)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_admin-0.6.4 spec/orm/mongoid.rb
rails_admin-0.6.3 spec/orm/mongoid.rb