lib/subj_models/nomenclature.rb in subj_models-0.6.1 vs lib/subj_models/nomenclature.rb in subj_models-0.6.2
- old
+ new
@@ -79,15 +79,19 @@
)
end
scope :order_by_name, -> (ordering) do
ordering = ordering.second.try(:to_sym)
- order(name: ordering)
+ if [:asc, :desc].include? ordering
+ order(name: ordering)
+ end
end
scope :order_by_popularity, -> (ordering) do
ordering = ordering.second.try(:to_sym)
- order(popularity: ordering)
+ if [:asc, :desc].include? ordering
+ order(popularity: ordering)
+ end
end
scope :attribute_value_ids, -> (attribute_value_name_strings) do
query_result = nil
nomenclature_ids = ids
\ No newline at end of file