Class: Lcms::Engine::DocumentForm
- Inherits:
-
Object
- Object
- Lcms::Engine::DocumentForm
- Includes:
- ActiveModel::Model, GoogleCredentials
- Defined in:
- app/forms/lcms/engine/document_form.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#service_errors ⇒ Object
readonly
Returns the value of attribute service_errors.
Instance Method Summary collapse
-
#initialize(attributes = {}, opts = {}) ⇒ DocumentForm
constructor
A new instance of DocumentForm.
- #save ⇒ Object
Constructor Details
#initialize(attributes = {}, opts = {}) ⇒ DocumentForm
Returns a new instance of DocumentForm.
18 19 20 21 22 |
# File 'app/forms/lcms/engine/document_form.rb', line 18 def initialize(attributes = {}, opts = {}) @is_reimport = attributes.delete(:reimport).present? || false super(attributes) @options = opts end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
16 17 18 |
# File 'app/forms/lcms/engine/document_form.rb', line 16 def document @document end |
#service_errors ⇒ Object (readonly)
Returns the value of attribute service_errors.
16 17 18 |
# File 'app/forms/lcms/engine/document_form.rb', line 16 def service_errors @service_errors end |
Instance Method Details
#save ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/forms/lcms/engine/document_form.rb', line 24 def save return false unless valid? @document = build_document after_reimport_hook @document.update(reimported: true) rescue StandardError => e @document&.update(reimported: false) Rails.logger.error "#{e.}\n #{e.backtrace.join("\n ")}" errors.add(:link, e.) false end |