Commit 14f9380951afde4a5cee556a6e95050d592add18

Authored by Daniel Beardsley
1 parent 8ce4e158
Exists in master and in 1 other branch production

App: don't obliterate app.==

Mongoid defines it's own ==() and eql?() methods that are based on the
ObjectId. Comparable provides it's own ==() function that uses `<=>`
under the hood.  == is used when inserting into a Hash, App docuemnts
are put in hashes hundreds of times per request. We don't was to to call
<=> hundreds of time.

Putting the Comparable mixin at the top allows the mongoid mixin to
override == with it's faster implementation.
Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
app/models/app.rb
1 1 class App
  2 + include Comparable
2 3 include Mongoid::Document
3 4 include Mongoid::Timestamps
4   - include Comparable
5 5  
6 6 field :name, :type => String
7 7 field :api_key
... ...