fae icon indicating copy to clipboard operation
fae copied to clipboard

ActiveRecord::ReadOnlyRecord (Fae::TextArea is marked as readonly):

Open tshedor opened this issue 10 years ago • 2 comments

From #135

Another error:

Steps to recreate

  1. Save a Fae Page with changes a textarea or text field
  2. Error appears:
ActiveRecord::ReadOnlyRecord (Fae::TextArea is marked as readonly):

activerecord (5.0.0) lib/active_record/persistence.rb:533:in `create_or_update'
activerecord (5.0.0) lib/active_record/callbacks.rb:298:in `block in create_or_update'
activesupport (5.0.0) lib/active_support/callbacks.rb:126:in `call'
activesupport (5.0.0) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
activesupport (5.0.0) lib/active_support/callbacks.rb:455:in `call'
activesupport (5.0.0) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
activesupport (5.0.0) lib/active_support/callbacks.rb:750:in `_run_save_callbacks'
activerecord (5.0.0) lib/active_record/callbacks.rb:298:in `create_or_update'
activerecord (5.0.0) lib/active_record/persistence.rb:125:in `save'
activerecord (5.0.0) lib/active_record/validations.rb:44:in `save'
activerecord (5.0.0) lib/active_record/attribute_methods/dirty.rb:22:in `save'
activerecord (5.0.0) lib/active_record/transactions.rb:319:in `block (2 levels) in save'
activerecord (5.0.0) lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
activerecord (5.0.0) lib/active_record/connection_adapters/abstract/database_statements.rb:230:in `transaction'
activerecord (5.0.0) lib/active_record/transactions.rb:211:in `transaction'
activerecord (5.0.0) lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
activerecord (5.0.0) lib/active_record/transactions.rb:319:in `block in save'
activerecord (5.0.0) lib/active_record/transactions.rb:334:in `rollback_active_record_state!'
activerecord (5.0.0) lib/active_record/transactions.rb:318:in `save'
activerecord (5.0.0) lib/active_record/suppressor.rb:41:in `save'
activerecord (5.0.0) lib/active_record/autosave_association.rb:440:in `save_has_one_association'

Temporary solution:

  1. Make a new concern in models/concerns/fae/text_area_concern.rb:
module Fae::TextAreaConcern
  extend ActiveSupport::Concern

  def readonly?
    false
  end
end
  1. Repeat for Fae::TextFieldConcern.

tshedor avatar Jul 31 '16 23:07 tshedor

+1 this works so good

LeChin avatar Aug 06 '16 22:08 LeChin

This is also required for uploads in a production environment when using Heroku, i.e.

module Fae::ImageConcern
  extend ActiveSupport::Concern

  def readonly?
    false
  end
end
module Fae::FileConcern
  extend ActiveSupport::Concern

  def readonly?
    false
  end
end

Unsure if this is necessary for Rails 5 or Heroku.

tshedor avatar Aug 15 '16 23:08 tshedor