Module: RailsConsolePro::RelationExtensions
- Defined in:
- lib/rails_console_pro/active_record_extensions.rb
Overview
ActiveRecord::Relation extensions
Instance Method Summary collapse
-
#export_to_file(file_path, format: nil) ⇒ Object
Export relation to file.
-
#to_html_export(style: :default) ⇒ Object
Export relation to HTML.
-
#to_json_export(pretty: true) ⇒ Object
Export relation to JSON.
-
#to_yaml_export ⇒ Object
Export relation to YAML.
Instance Method Details
#export_to_file(file_path, format: nil) ⇒ Object
Export relation to file
73 74 75 |
# File 'lib/rails_console_pro/active_record_extensions.rb', line 73 def export_to_file(file_path, format: nil) FormatExporter.export_to_file(self, file_path, format: format) end |
#to_html_export(style: :default) ⇒ Object
Export relation to HTML
68 69 70 |
# File 'lib/rails_console_pro/active_record_extensions.rb', line 68 def to_html_export(style: :default) FormatExporter.to_html(self, title: "#{klass.name} Collection (#{count} records)", style: style) end |
#to_json_export(pretty: true) ⇒ Object
Export relation to JSON
58 59 60 |
# File 'lib/rails_console_pro/active_record_extensions.rb', line 58 def to_json_export(pretty: true) FormatExporter.to_json(self, pretty: pretty) end |
#to_yaml_export ⇒ Object
Export relation to YAML
63 64 65 |
# File 'lib/rails_console_pro/active_record_extensions.rb', line 63 def to_yaml_export FormatExporter.to_yaml(self) end |