Sha256: 6ea3c634255015436f93d2cbb960e5d0896a602b7d6cbcc1ee2d40341b507845
Contents?: true
Size: 1.67 KB
Versions: 16
Compression:
Stored size: 1.67 KB
Contents
# AttrSearchable to SearchCop As the set of features of AttrSearchable grew and grew, it has been neccessary to change its DSL and name, as no `attr_searchable` method is present anymore. The new DSL is cleaner and more concise. Morever, the migration process is simple. ## Installation Change gem 'attr_searchable' to gem 'search_cop' And then execute: $ bundle Or install it yourself as: $ gem install search_cop ## General DSL AttrSearchable: ```ruby class Book < ActiveRecord::Base include AttrSearchable scope :search_scope, lambda { eager_load :comments, :users, :user } attr_searchable :title, :description attr_searchable :comment => ["comments.title", "comments.message"] attr_searchable :user => ["users.username", "users_books.username"] attr_searchable_options :title, :type => :fulltext, :default => true attr_searchable_alias :users_books => :user end ``` SearchCop: ```ruby class Book < ActiveRecord::Base include SearchCop search_scope :search do attributes :title, :description attributes :comment => ["comments.title", "comments.message"] attributes :user => ["users.username", "users_books.username"] options :title, :type => :fulltext, :default => true aliases :users_books => :user scope { eager_load :comments, :users, :user } end end ``` ## Reflection AttrSearchable: ```ruby Book.searchable_attributes Book.searchable_attribute_options Book.default_searchable_attributes Book.searchable_aliases ``` SearchCop: ```ruby Book.search_reflection(:search).attributes Book.search_reflection(:search).options Book.search_reflection(:search).default_attributes Book.search_reflection(:search).aliases ```
Version data entries
16 entries across 16 versions & 1 rubygems