Skip to content

Add key_type option to table method#910

Merged
andrykonchin merged 5 commits intoDynamoid:masterfrom
ogidow:add-key-type-option
Jun 8, 2025
Merged

Add key_type option to table method#910
andrykonchin merged 5 commits intoDynamoid:masterfrom
ogidow:add-key-type-option

Conversation

@ogidow
Copy link
Contributor

@ogidow ogidow commented Jun 1, 2025

My project uses integer type hash key.

Currently, if we specify integer key to hash key, we need to do below process on dynamoid

  1. define hash key with table method
  2. override hash key type by field method
class Model
  include Dynamoid::Document
  
  table key: :hash_key # hash_key define as string type

  field :hash_key, :integer # override hash_key type to integer from string
end

But, when we override attribute, dynamoid notice us warning message like

'Method hash_key= generated for the field hash_key overrides already existing method'
'Method hash_key generated for the field hash_key overrides already existing method'

So, I'd like to add key_type option to specify type to hash key on table method to avoid warning message.

@andrykonchin
Copy link
Member

Thank you! Looks good. I was considering this feature for a long time.

@andrykonchin
Copy link
Member

There is nothing to do for you - I will handle the CI failure.

@andrykonchin andrykonchin force-pushed the add-key-type-option branch from 583c816 to a539da8 Compare June 8, 2025 13:24
@andrykonchin andrykonchin force-pushed the add-key-type-option branch from a539da8 to 78dabe7 Compare June 8, 2025 13:25
@andrykonchin andrykonchin merged commit 3f23dbf into Dynamoid:master Jun 8, 2025
70 checks passed
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.

2 participants