Mongoid is unruby

Posted by Anton Katunin on 18 August 2014
Tags: code, ruby, mongoid

mongoid (4.0.0)

# user.rb
class User
  include Mongoid::Document

end
# some_file.rb
u = User.first
env = u.attributes.slice '_id'

(env['blah'] ||= {}).tap do |blah|
    blah['x'] = 'Hello'
end

env # ???
# some_file.rb
Array == User.last.tracking_profiles.class
Array === User.last.tracking_profiles

Read next:

Comparison in Ruby

at BrisRuby meetup