Module: E9Tags::TaggingExtension::ClassMethods

Defined in:
lib/e9_tags/tagging_extension.rb

Instance Method Summary collapse

Instance Method Details

#contexts(options = {}) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/e9_tags/tagging_extension.rb', line 28

def contexts(options = {})
  scope = select("DISTINCT #{table_name}.context")

  if !options[:show_all]
    condition = arel_table[:context].matches('%__H__')
    condition = condition.not unless options[:show_hidden]
    scope = scope.where(condition)
  end

  connection.select_values(scope.to_sql)
end