spec/models/mongoid.rb in activesearch-0.0.7 vs spec/models/mongoid.rb in activesearch-0.0.8
- old
+ new
@@ -9,25 +9,29 @@
field :title, type: String
field :text, type: String
field :junk, type: String
field :special, type: Boolean, default: false
- search_by :title, :text, store: [:title, :junk], unless: :special
+ search_by [:title, :text, store: [:title, :junk]], unless: :special
end
class AnotherMongoidModel
include Mongoid::Document
include ActiveSearch::Mongoid
field :title, type: String
- search_by lambda { [:title, :text, store: [:title]] } # Simulating dynamic options
+ search_by :options_for_search
+
+ def options_for_search
+ [:title, :text, store: [:title]]
+ end
end
class LocalizedMongoidModel
include Mongoid::Document
include ActiveSearch::Mongoid
field :title, localize: true
field :special_type
- search_by :title, store: [:title]
+ search_by [:title, store: [:title]]
end
\ No newline at end of file