Skip to content

Instantly share code, notes, and snippets.

@MasterLambaster
Created June 29, 2010 14:16
Show Gist options
  • Save MasterLambaster/457261 to your computer and use it in GitHub Desktop.
Save MasterLambaster/457261 to your computer and use it in GitHub Desktop.
activemodel (3.0.0.beta4)
activesupport (3.0.0.beta4)
bson (1.0.3)
builder (2.1.2)
i18n (0.4.1)
mongo (1.0.3)
mongoid (2.0.0.beta7)
rake (0.8.7)
rdoc (2.5.8)
tzinfo (0.3.22)
will_paginate (3.0.pre)
========Before mongoid
Respond to asc - false: undefined method `asc' for :sym:Symbol
Respond to ascending - false: undefined method `ascending' for :sym:Symbol
Respond to desc - false: undefined method `desc' for :sym:Symbol
Respond to descending - false: undefined method `descending' for :sym:Symbol
Respond to gt - false: undefined method `gt' for :sym:Symbol
Respond to lt - false: undefined method `lt' for :sym:Symbol
Respond to gte - false: undefined method `gte' for :sym:Symbol
Respond to lte - false: undefined method `lte' for :sym:Symbol
Respond to ne - false: undefined method `ne' for :sym:Symbol
Respond to near - false: undefined method `near' for :sym:Symbol
Respond to in - false: undefined method `in' for :sym:Symbol
Respond to nin - false: undefined method `nin' for :sym:Symbol
Respond to mod - false: undefined method `mod' for :sym:Symbol
Respond to all - false: undefined method `all' for :sym:Symbol
Respond to size - false: undefined method `size' for :sym:Symbol
Respond to exists - false: undefined method `exists' for :sym:Symbol
Respond to within - false: undefined method `within' for :sym:Symbol
========After mongoid
Respond to asc - false: undefined method `asc' for :sym:Symbol
Respond to ascending - false: undefined method `ascending' for :sym:Symbol
Respond to desc - false: undefined method `desc' for :sym:Symbol
Respond to descending - false: undefined method `descending' for :sym:Symbol
Respond to gt - true: #<Mongoid::Criterion::Complex:0xb73c52a0 @operator="gt", @key=:sym>
Respond to lt - true: #<Mongoid::Criterion::Complex:0xb73c51c4 @operator="lt", @key=:sym>
Respond to gte - true: #<Mongoid::Criterion::Complex:0xb73c50fc @operator="gte", @key=:sym>
Respond to lte - true: #<Mongoid::Criterion::Complex:0xb73c5034 @operator="lte", @key=:sym>
Respond to ne - true: #<Mongoid::Criterion::Complex:0xb73c4f6c @operator="ne", @key=:sym>
Respond to near - true: #<Mongoid::Criterion::Complex:0xb73c4ea4 @operator="near", @key=:sym>
Respond to in - true: #<Mongoid::Criterion::Complex:0xb73c4ddc @operator="in", @key=:sym>
Respond to nin - true: #<Mongoid::Criterion::Complex:0xb73c4d14 @operator="nin", @key=:sym>
Respond to mod - true: #<Mongoid::Criterion::Complex:0xb73c4c4c @operator="mod", @key=:sym>
Respond to all - true: #<Mongoid::Criterion::Complex:0xb73c4b84 @operator="all", @key=:sym>
Respond to size - true: #<Mongoid::Criterion::Complex:0xb73c4abc @operator="size", @key=:sym>
Respond to exists - true: #<Mongoid::Criterion::Complex:0xb73c49f4 @operator="exists", @key=:sym>
Respond to within - true: #<Mongoid::Criterion::Complex:0xb73c492c @operator="within", @key=:sym>
========Before mongoid
Respond to asc - false: undefined method `asc' for :sym:Symbol
Respond to ascending - false: undefined method `ascending' for :sym:Symbol
Respond to desc - false: undefined method `desc' for :sym:Symbol
Respond to descending - false: undefined method `descending' for :sym:Symbol
Respond to gt - false: undefined method `gt' for :sym:Symbol
Respond to lt - false: undefined method `lt' for :sym:Symbol
Respond to gte - false: undefined method `gte' for :sym:Symbol
Respond to lte - false: undefined method `lte' for :sym:Symbol
Respond to ne - false: undefined method `ne' for :sym:Symbol
Respond to near - false: undefined method `near' for :sym:Symbol
Respond to in - false: undefined method `in' for :sym:Symbol
Respond to nin - false: undefined method `nin' for :sym:Symbol
Respond to mod - false: undefined method `mod' for :sym:Symbol
Respond to all - false: undefined method `all' for :sym:Symbol
Respond to size - true: 3
Respond to exists - false: undefined method `exists' for :sym:Symbol
Respond to within - false: undefined method `within' for :sym:Symbol
========After mongoid
Respond to asc - false: undefined method `asc' for :sym:Symbol
Respond to ascending - false: undefined method `ascending' for :sym:Symbol
Respond to desc - false: undefined method `desc' for :sym:Symbol
Respond to descending - false: undefined method `descending' for :sym:Symbol
Respond to gt - true: #<Mongoid::Criterion::Complex:0xa82bc20 @key=:sym, @operator="gt">
Respond to lt - true: #<Mongoid::Criterion::Complex:0xa82bb1c @key=:sym, @operator="lt">
Respond to gte - true: #<Mongoid::Criterion::Complex:0xa82ba2c @key=:sym, @operator="gte">
Respond to lte - true: #<Mongoid::Criterion::Complex:0xa82b93c @key=:sym, @operator="lte">
Respond to ne - true: #<Mongoid::Criterion::Complex:0xa82b84c @key=:sym, @operator="ne">
Respond to near - true: #<Mongoid::Criterion::Complex:0xa82b75c @key=:sym, @operator="near">
Respond to in - true: #<Mongoid::Criterion::Complex:0xa82b66c @key=:sym, @operator="in">
Respond to nin - true: #<Mongoid::Criterion::Complex:0xa82b57c @key=:sym, @operator="nin">
Respond to mod - true: #<Mongoid::Criterion::Complex:0xa82b48c @key=:sym, @operator="mod">
Respond to all - true: #<Mongoid::Criterion::Complex:0xa82b39c @key=:sym, @operator="all">
Respond to size - true: #<Mongoid::Criterion::Complex:0xa82b2ac @key=:sym, @operator="size">
Respond to exists - true: #<Mongoid::Criterion::Complex:0xa82b1bc @key=:sym, @operator="exists">
Respond to within - true: #<Mongoid::Criterion::Complex:0xa82b0cc @key=:sym, @operator="within">
require 'rubygems'
@map = %w{asc ascending desc descending gt lt gte
lte ne near in nin mod all size exists
within}
def dump()
@map.each do |op|
print("Respond to #{op} - #{:sym.respond_to?(op.to_sym, true)}: ",
begin
:sym.send(op.to_sym).inspect
rescue
$!
end, "\n")
end
end
print "="*8+"Before mongoid\n"
dump()
print "="*8+"After mongoid\n"
require 'mongoid'
dump()
@durran
Copy link

durran commented Jun 29, 2010

The sorting symbol methods are in master, not in beta7 gem.

http://github.com/durran/mongoid/commit/e8490391050aeeb3963fe7b3b3df8142424464a4

@MasterLambaster
Copy link
Author

Got it! The right commit is http://github.com/durran/mongoid/commit/9cb502ae167e6d2d1da0ee128c07d3cdaf86be06 though.
It's about symbol extension. Seems that commit is made one day after gem was released.
Will use git master as a source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment