Module: RailsPGExtras
- Defined in:
- lib/rails-pg-extras.rb,
lib/rails-pg-extras/version.rb
Defined Under Namespace
Classes: Railtie
Constant Summary collapse
- QUERIES =
RubyPGExtras::QUERIES
- DEFAULT_ARGS =
RubyPGExtras::DEFAULT_ARGS
- VERSION =
"1.3.1"
Class Method Summary collapse
Class Method Details
.run_query(query_name:, in_format:, args: {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rails-pg-extras.rb', line 20 def self.run_query(query_name:, in_format:, args: {}) sql = if (custom_args = DEFAULT_ARGS[query_name].merge(args)) != {} RubyPGExtras.sql_for(query_name: query_name) % custom_args else RubyPGExtras.sql_for(query_name: query_name) end result = connection.execute(sql) RubyPGExtras.display_result( result, title: RubyPGExtras.description_for(query_name: query_name), in_format: in_format ) end |