ActiveResource and serialize combination: inconsistent results #34

Closed
iox opened this Issue Aug 9, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@iox

iox commented Aug 9, 2012

I have a User ActiveRecord model and a Page ActiveResource. I'm using "serialize" in the User model to cache some pages related to every user. It usually works nicely, but I have detected errors when the Page class hasn't been accessed yet. An example in console:

User.last.update_attribute(:pages, Page.all)
User.last.pages.class  => Array

I exit the console and start it again

User.last.pages.class  => String # This is the problem, it's not being unserialized correctly
test = Page.new # I load the Page class in a completely independent call
User.last.pages.class  => Array # This returns Array, working again!

I'm not sure if this is an error of ActiveResource, but my guess is that the ActiveResource classes should be loaded when the application starts. What do you think?

@rails-bot rails-bot bot added the stale label May 5, 2017

@rails-bot

This comment has been minimized.

Show comment Hide comment
@rails-bot

rails-bot bot May 5, 2017

This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails team are limited, and so we are asking for your help.

If it is an issue and you can still reproduce this error on the master branch,
please reply with all of the information you have about it in order to keep the issue open.

If it is a pull request and you are still interested on having it merged please make sure it can be merged clearly.

Thank you for all your contributions.

rails-bot bot commented May 5, 2017

This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails team are limited, and so we are asking for your help.

If it is an issue and you can still reproduce this error on the master branch,
please reply with all of the information you have about it in order to keep the issue open.

If it is a pull request and you are still interested on having it merged please make sure it can be merged clearly.

Thank you for all your contributions.

@rafaelfranca

This comment has been minimized.

Show comment Hide comment
@rafaelfranca

rafaelfranca May 5, 2017

Owner

This issue has been automatically marked as stale because it has not been commented on for at least three months.

The resources of the Rails team are limited, and so we are asking for your help.

If it is an issue and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If it is a pull request and you are still interested on having it merged please make sure it can be merged clearly.

Thank you for all your contributions.

Owner

rafaelfranca commented May 5, 2017

This issue has been automatically marked as stale because it has not been commented on for at least three months.

The resources of the Rails team are limited, and so we are asking for your help.

If it is an issue and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If it is a pull request and you are still interested on having it merged please make sure it can be merged clearly.

Thank you for all your contributions.

@iox

This comment has been minimized.

Show comment Hide comment
@iox

iox May 6, 2017

I don't think this is relevant any more. It was a corner case, and I have not encountered it again. Closing.

iox commented May 6, 2017

I don't think this is relevant any more. It was a corner case, and I have not encountered it again. Closing.

@iox iox closed this May 6, 2017

@rails-bot rails-bot bot removed the stale label May 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment