File: 0-helpers.rb

package info (click to toggle)
ruby-acts-as-taggable-on 11.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 596 kB
  • sloc: ruby: 3,924; makefile: 8
file content (32 lines) | stat: -rw-r--r-- 653 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def using_sqlite?
  ActsAsTaggableOn::Utils.connection && ActsAsTaggableOn::Utils.connection.adapter_name == 'SQLite'
end

def supports_concurrency?
  !using_sqlite?
end

def using_postgresql?
  ActsAsTaggableOn::Utils.using_postgresql?
end

def postgresql_version
  if using_postgresql?
    ActsAsTaggableOn::Utils.connection.execute('SHOW SERVER_VERSION').first['server_version'].to_f
  else
    0.0
  end
end

def postgresql_support_json?
  postgresql_version >= 9.2
end


def using_mysql?
  ActsAsTaggableOn::Utils.using_mysql?
end

def using_case_insensitive_collation?
  using_mysql? && ActsAsTaggableOn::Utils.connection.collation =~ /_ci\Z/
end