search_magic 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock
CHANGED
@@ -34,7 +34,7 @@ module SearchMagic
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def arrange(arrangeable, direction = :asc)
|
37
|
-
arrangeable.blank? || !searchables.keys.include?(arrangeable) ? criteria : order_by([["arrangeable_values.#{arrangeable}", direction]])
|
37
|
+
arrangeable.blank? || !searchables.keys.include?(arrangeable.to_sym) ? criteria : order_by([["arrangeable_values.#{arrangeable}", direction]])
|
38
38
|
end
|
39
39
|
|
40
40
|
private
|
data/lib/search_magic/version.rb
CHANGED
@@ -64,6 +64,13 @@ describe SearchMagic::FullTextSearch do
|
|
64
64
|
its(:options) { should include(:sort => [["arrangeable_values.title", :asc]]) }
|
65
65
|
end
|
66
66
|
|
67
|
+
context "when arranging a model by a searchable.to_s" do
|
68
|
+
subject { Asset.arrange("title") }
|
69
|
+
it { should be_a(Mongoid::Criteria) }
|
70
|
+
its(:options) { should_not be_empty }
|
71
|
+
its(:options) { should include(:sort => [["arrangeable_values.title", :asc]]) }
|
72
|
+
end
|
73
|
+
|
67
74
|
context "when arranging a model on multiple searchables" do
|
68
75
|
subject { Asset.arrange(:title).arrange(:tag) }
|
69
76
|
it { should be_a(Mongoid::Criteria) }
|