Module: PgHero::BaseHelper

Defined in:
app/helpers/pg_hero/base_helper.rb

Instance Method Summary collapse

Instance Method Details

#pghero_pretty_ident(table, schema: nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'app/helpers/pg_hero/base_helper.rb', line 3

def pghero_pretty_ident(table, schema: nil)
  ident = table
  if schema && schema != "public"
    ident = "#{schema}.#{table}"
  end
  if ident =~ /\A[a-z0-9_]+\z/
    ident
  else
    @database.quote_ident(ident)
  end
end