Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal to fix silent marshal failure #176

Closed
pierre-pretorius opened this issue May 15, 2015 · 3 comments
Closed

Proposal to fix silent marshal failure #176

pierre-pretorius opened this issue May 15, 2015 · 3 comments

Comments

@pierre-pretorius
Copy link

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?

@nateware
Copy link
Owner

This is really cool and elegant... does anything need to be done other than just update the README?

@pierre-pretorius
Copy link
Author

We have been using it like that in production for quite some time now so I suspect the answer is no.

@nateware
Copy link
Owner

Ok thanks, will link to this from the readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants