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

Feature: delegate ID #124

Open
lewispb opened this issue Aug 10, 2023 · 0 comments
Open

Feature: delegate ID #124

lewispb opened this issue Aug 10, 2023 · 0 comments

Comments

@lewispb
Copy link
Contributor

lewispb commented Aug 10, 2023

Currently Kredis supports manually constructing a key, this is often required to capture the relationship between a user and an object:

class Widgets::Selection
  kredis_set :selected_widgets, typed: :integer, key: ->(selection) { "identity:#{selection.identity.id}:selected_widgets" }

  attr_accessor :identity
end

It'd be nice if Kredis supported this common scenario, generating an appropriately scoped key (useful for any future incineration):

class Widgets::Selection
  kredis_set :selected_widgets, typed: :integer, identified_by: :identity

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

Successfully merging a pull request may close this issue.

1 participant