Sha256: 1538af79f9f04ecacbaa899252cde708d5da97666dd48d8c4b74fc844344a0b1

Contents?: true

Size: 819 Bytes

Versions: 10

Compression:

Stored size: 819 Bytes

Contents

module PgHero
  module HomeHelper
    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

    def pghero_js_var(name, value)
      "var #{name} = #{json_escape(value.to_json(root: false))};".html_safe
    end

    def pghero_remove_index(query)
      if query[:columns]
        columns = query[:columns].map(&:to_sym)
        columns = columns.first if columns.size == 1
      end
      ret = String.new("remove_index #{query[:table].to_sym.inspect}")
      ret << ", name: #{(query[:name] || query[:index]).to_s.inspect}"
      ret << ", column: #{columns.inspect}" if columns
      ret
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
pghero-2.7.4 app/helpers/pg_hero/home_helper.rb
pghero_fork-2.7.3 app/helpers/pg_hero/home_helper.rb
pghero-2.7.3 app/helpers/pg_hero/home_helper.rb
pghero-2.7.2 app/helpers/pg_hero/home_helper.rb
pghero-2.7.1 app/helpers/pg_hero/home_helper.rb
pghero-2.7.0 app/helpers/pg_hero/home_helper.rb
pghero-2.6.0 app/helpers/pg_hero/home_helper.rb
pghero-2.5.1 app/helpers/pg_hero/home_helper.rb
pghero-2.5.0 app/helpers/pg_hero/home_helper.rb
pghero-2.4.2 app/helpers/pg_hero/home_helper.rb