Sha256: 8b81d6fa09e3d9175248deba44ad1bf460b4ec44548057ee6c71a8a40e701e27

Contents?: true

Size: 492 Bytes

Versions: 21

Compression:

Stored size: 492 Bytes

Contents

module Hirb::Views::MongoDb #:nodoc:
  def mongoid__document_view(obj)
    fields = obj.class.fields.keys
    fields.delete('_id')
    fields.unshift('_id')
    {:fields=>fields}
  end

  def mongo_mapper__document_view(obj)
    fields = obj.class.column_names
    fields.delete('_id') && fields.unshift('_id')
    {:fields=>fields}
  end
  alias_method :mongo_mapper__embedded_document_view, :mongo_mapper__document_view
end

Hirb::DynamicView.add Hirb::Views::MongoDb, :helper=>:auto_table

Version data entries

21 entries across 20 versions & 3 rubygems

Version Path
hirber-0.8.7 lib/hirb/views/mongo_db.rb
hirber-0.8.6 lib/hirb/views/mongo_db.rb
hirber-0.8.5 lib/hirb/views/mongo_db.rb
hirber-0.8.4 lib/hirb/views/mongo_db.rb
hirber-0.8.2 lib/hirb/views/mongo_db.rb
hirber-0.8.1 lib/hirb/views/mongo_db.rb
hirber-0.8.0 lib/hirb/views/mongo_db.rb
hirb-0.7.3 lib/hirb/views/mongo_db.rb
climine-0.0.7 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/lib/hirb/views/mongo_db.rb
climine-0.0.7 vendor/bundle/ruby/2.1.0/gems/hirb-0.7.1/lib/hirb/views/mongo_db.rb
hirb-0.7.2 lib/hirb/views/mongo_db.rb
climine-0.0.6 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/lib/hirb/views/mongo_db.rb
climine-0.0.5 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/lib/hirb/views/mongo_db.rb
climine-0.0.4 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/lib/hirb/views/mongo_db.rb
climine-0.0.3 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/lib/hirb/views/mongo_db.rb
climine-0.0.2 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/lib/hirb/views/mongo_db.rb
climine-0.0.1 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/lib/hirb/views/mongo_db.rb
hirb-0.7.1 lib/hirb/views/mongo_db.rb
hirb-0.7.0 lib/hirb/views/mongo_db.rb
hirb-0.6.2 lib/hirb/views/mongo_db.rb