Module: RailsConsolePro::ActiveRecordExtensions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/rails_console_pro/active_record_extensions.rb
Overview
ActiveRecord extensions for export functionality
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#export_to_file(file_path, format: nil) ⇒ Object
Export record to file.
-
#to_html_export(style: :default) ⇒ Object
Export record to HTML.
-
#to_json_export(pretty: true) ⇒ Object
Export record to JSON.
-
#to_yaml_export ⇒ Object
Export record to YAML.
Instance Method Details
#export_to_file(file_path, format: nil) ⇒ Object
Export record to file
50 51 52 |
# File 'lib/rails_console_pro/active_record_extensions.rb', line 50 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 record to HTML
45 46 47 |
# File 'lib/rails_console_pro/active_record_extensions.rb', line 45 def to_html_export(style: :default) FormatExporter.to_html(self, title: "#{self.class.name} ##{id}", style: style) end |
#to_json_export(pretty: true) ⇒ Object
Export record to JSON
35 36 37 |
# File 'lib/rails_console_pro/active_record_extensions.rb', line 35 def to_json_export(pretty: true) FormatExporter.to_json(self, pretty: pretty) end |
#to_yaml_export ⇒ Object
Export record to YAML
40 41 42 |
# File 'lib/rails_console_pro/active_record_extensions.rb', line 40 def to_yaml_export FormatExporter.to_yaml(self) end |