Skip to content

Proposal to fix silent marshal failure #176

Closed
@pierre-pretorius

Description

@pierre-pretorius

Hi

It looks like most users workaround the silent marshal failure (#91) by making sure the class you are marshalling is loaded. Example:

require 'post'

class User
  include Redis::Objects
  list :my_posts, :marshal => true
end

This often causes double load warnings such as: warning: already initialized constant Post::SOME_CONSTANT.

An elegant fix that works with this gem currently is:

class User
  include Redis::Objects
  list :my_posts, :marshal => Post
end

When the user class is loaded it will cause Rails to autoload the Post model as well so marshalling will work. This gem still evaluates the value passed as truthy so everything keeps working as expected. What is the possibility of making this an actual feature instead of accidental elegant solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions