Skip to content
Snippets Groups Projects
Commit 7b692e04 authored by ArtOfCode-'s avatar ArtOfCode-
Browse files

Rubocop

parent 5ef8782a
No related branches found
No related tags found
No related merge requests found
...@@ -32,7 +32,7 @@ class ApplicationRecord < ActiveRecord::Base ...@@ -32,7 +32,7 @@ class ApplicationRecord < ActiveRecord::Base
end end
def self.sanitize_sql_in(ary) def self.sanitize_sql_in(ary)
return "(NULL)" unless ary.present? && ary.respond_to?(:map) return '(NULL)' unless ary.present? && ary.respond_to?(:map)
ary = ary.map { |el| ActiveRecord::Base.sanitize_sql_array(['?', el]) } ary = ary.map { |el| ActiveRecord::Base.sanitize_sql_array(['?', el]) }
"(#{ary.join(', ')})" "(#{ary.join(', ')})"
......
class Tag < ApplicationRecord class Tag < ApplicationRecord
include CommunityRelated include CommunityRelated
scope :category_order, -> (required_ids, topic_ids) do scope :category_order, lambda { |required_ids, topic_ids|
helpers = ActionController::Base.helpers
order(Arel.sql("id IN #{sanitize_sql_in(required_ids)} DESC"), order(Arel.sql("id IN #{sanitize_sql_in(required_ids)} DESC"),
Arel.sql("id IN #{sanitize_sql_in(topic_ids)} DESC"), Arel.sql("id IN #{sanitize_sql_in(topic_ids)} DESC"),
name: :asc) name: :asc)
end }
has_and_belongs_to_many :posts has_and_belongs_to_many :posts
belongs_to :tag_set belongs_to :tag_set
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment