Created
          January 19, 2011 01:06 
        
      - 
      
 - 
        
Save joshcutler/785489 to your computer and use it in GitHub Desktop.  
    This is gist to show the mongoid group
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class Item | |
| include Mongoid::Document | |
| field :fulltext, :type => String, :default => "" | |
| field :_keywords, :type => Array | |
| index :_keywords | |
| field :created_by_id, :type => Integer | |
| index :created_by_id | |
| field :item_validated, :type => Boolean | |
| index :item_validated | |
| field :mysql_id, :type => Integer | |
| index :mysql_id | |
| field :owner_ids, :type => Array, :default => [] | |
| index :owner_ids | |
| field :wantlist_ids, :type => Array, :default => [] | |
| index :wantlist_ids | |
| field :wantlist_blacklisted_ids, :type => Array, :default => [] | |
| index :wantlist_blacklisted_ids | |
| field :tradelist_ids, :type => Array, :default => [] | |
| index :tradelist_ids | |
| field :tradelist_blacklisted_ids, :type => Array, :default => [] | |
| index :tradelist_blacklisted_ids | |
| field :major_type_id, :type => Integer | |
| index :major_type_id | |
| field :year, :type => Integer | |
| index :year | |
| field :set_id, :type => Integer | |
| index :set_id | |
| field :set_name, :type => String | |
| index :set_name | |
| field :subset_id, :type => Integer | |
| index :subset_id | |
| field :subset_name, :type => String | |
| index :subset_name | |
| field :team_id, :type => Integer | |
| index :team_id | |
| field :team_name, :type => String | |
| index :team_name | |
| field :name, :type => String | |
| index :name | |
| field :intNumber, :type => Integer | |
| index :intNumber | |
| field :number, :type => String | |
| index :number | |
| validates_presence_of :mysql_id | |
| validates_presence_of :major_type_id | |
| before_save :tokenize_fulltext | |
| private | |
| def tokenize_fulltext | |
| self.fulltext ||= "" | |
| self._keywords = self.fulltext.downcase.gsub(/\./, "").gsub(/\\|\//, " ").split(" ") | |
| end | |
| end | |
| #<Item _id: 4d339ef4f245c1d587041adb, number: nil, intNumber: nil, name: nil, _keywords: ["2003", "fleer", "genuine", "longball", "threats", "single", "swatch", "9", "9a", "mordonez", "jsy-andruw"], set_id: 10826, item_validated: true, created_by_id: nil, subset_id: 49828, tradelist_blacklisted_ids: nil, wantlist_blacklisted_ids: nil, mysql_id: 513601, owner_ids: [], team_name: nil, major_type_id: 1, fulltext: "2003 Fleer Genuine Longball Threats Single Swatch 9 9A MOrdonez Jsy-Andruw", year: 2003, subset_name: nil, set_name: nil, team_id: nil, tradelist_ids: nil, wantlist_ids: nil> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment