-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
I just upgraded to 0.0.5 to 0.1.2, and noticed some specs failing. With my Story model like:
class Story < ActiveRecord::Base
serialize :data, ActiveRecord::Coders::NestedHstore` I had a spec like:
def twitter_title
data && data["twitterDescription"] ? data["twitterDescription"] : title
end
end
Then my spec like:
story = create(:story, title: "This is the title", data: {twitterDescription: "Title"})
story.twitter_title.should == "Title"
This was passing before. Now it doesn't pass because story.data["twitterDescription"] == nil and story.data[:twitterDescription] == "Title".
To fix my spec, I need to change it to:
story = create(:story, title: "This is the title", data: {twitterDescription: "Title"})
story.reload
story.twitter_title.should == "Title"
Is this a bug or intended behavior? I'd prefer the previous behavior, where the output was consistent before and after the model had been reloaded. The keys were always strings and I could code for that.
To clarify: if you set a hash with string keys, they stay string keys before and after a model reload. If you set a hash with symbol keys, they'll be symbols until you reload the model and then they'll be strings.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels