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

Store types implemented. OpenStruct store type implemented. #4055

Closed
wants to merge 1 commit into from
Closed

Store types implemented. OpenStruct store type implemented. #4055

wants to merge 1 commit into from

Conversation

Antiarchitect
Copy link
Contributor

I think OpenStruct fits for serialization pretty well. So I've implemented support of store type generally and OpenStruct store type case.

@josevalim
Copy link
Contributor

Thanks for the pull request. However instead of adding clauses to the current code, we should just assume that [] and []= is the API that one needs to implement in order to use Store. So while adding :type as an option is fine, the remaining changes are just adding conditions that should actually be simply using duck typing.

@Antiarchitect
Copy link
Contributor Author

How about this approach? Have I understand you correctly?

@josevalim
Copy link
Contributor

Yeah, you got me correctly. :) But I don't think we (Rails) should monkey patch OpenStruct. You can probably do that in your apps though. :)

@Antiarchitect
Copy link
Contributor Author

Ok :) But OpenStruct is good for serialization anyway :)

@tenderlove
Copy link
Member

This would probably be better as a third party gem for now. Thanks.

@tenderlove tenderlove closed this Dec 20, 2011
@jeremy
Copy link
Member

jeremy commented Dec 20, 2011

Check out ActiveSupport::OrderedOptions for an OpenStruct-like hash.

@Antiarchitect
Copy link
Contributor Author

Probably found a bug with OrderedHash and OrderedOptions deserialization type mismatch:

ActiveRecord::SerializationTypeMismatch: Attribute was supposed to be a ActiveSupport::OrderedOptions, but was a Psych::Omap

Look here #4072

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

Successfully merging this pull request may close these issues.

None yet

4 participants