active_model_serializers icon indicating copy to clipboard operation
active_model_serializers copied to clipboard

Issue with autoload changed file

Open abratashov opened this issue 4 years ago • 0 comments

Expected behavior vs actual behavior

After changing model/library methods should serializer reloads all changes.

Steps to reproduce

When I define and change model method:

# app/models/document.rb

class Document < ApplicationRecord
  def url
    # ...
  end
end

it doesn't autoload in the serializer:

class DocumentSerializer < ActiveModel::Serializer
  attributes :url
end

After request on API it returns the previous version of url, as a result I need to restart Rails server to get changes.

#config/initializers/serializer.rb
ActiveModelSerializers.config.adapter = :json_api

Environment

ActiveModelSerializers Version (commit ref if not on tag): active_model_serializers (0.10.12)

Output of ruby -e "puts RUBY_DESCRIPTION": ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]

OS Type & Version: Ubuntu 20.04

Integrated application and version (e.g., Rails, Grape, etc): rails (6.1.0) but also (6.1.3)

Other

Also created question https://stackoverflow.com/questions/66496188/problem-with-active-model-serializer-auto-reloading-after-changed-files-in-rails

abratashov avatar Mar 15 '21 11:03 abratashov