Skip to content

Manage several serialized hash with same key. #7

@Yoshyn

Description

@Yoshyn

Hi.

I saw your presentation on ParisRB and i realy like your gem. It will be great if we can manage serialized hash with same key.

Let me explain :

class Data < ActiveRecord::Base
  typed_store :hash1 do |s|
    s.string :field
  end

  typed_store :hash2 do |s|
    s.string :field
  end
end

Data.new.field

The previous code will always search in the second hash the field.

It can be usefull to add something like this :

  typed_store :hashX, prefix: true do |s|
    s.string :field
  end

And after, access to field with something like : Data.new.hashX_field

I just made a commit here :
Yoshyn@cdd0b08

The code is not realy good and it's only for AR_32. I just made this to unterstand your code and see if it's possible (I am not familiar with github. Does my commit need a pull request in this case?).

What do you thing about the main idea?

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