module RailsDb::Helpers
Constants
- STYLES
-
TODO check styles
Public Instance Methods
Source
# File lib/rails_db/helpers.rb, line 31 def rails_db_data_table(table_name, options = {}) options.reverse_merge!( style: :default, header: true, footer: false, columns: [], limit: nil, order_by: nil, order: :asc ) table = RailsDb::Table.new(table_name) .limit(options[:limit]) .order_by(options[:order_by]) .select(options[:columns]) .order(options[:order]) render '/rails_db/shared/data_table', table: table, header: options[:header], footer: options[:footer], style: options[:style] end
Source
# File lib/rails_db/helpers.rb, line 53 def rails_db_data_table_sql(sql, options = {}) options.reverse_merge!( style: :default, header: true, footer: false, ) sql = "#{sql}".strip sql_query = RailsDb::SqlQuery.new(sql, false).execute render '/rails_db/shared/sql_result', sql_query: sql_query, header: options[:header], footer: options[:footer], style: options[:style] end
Source
# File lib/rails_db/helpers.rb, line 68 def rails_db_table_style(tag, style) style = STYLES[style] || STYLES[:default] style[tag.to_sym] end