Support for HashWithIndifferentAccess / Symbolized Keys
还没有人认领这个 Issue。
评估
调研方向
首先复现使用符号键的 map_attr 默认值示例,以及 ERB 的 my_data.except(:name) 示例。跟踪 issue 中提到的 map_attr 和面向视图的入口点,然后确定有无 ActiveSupport 时所支持的行为。完成的标准是:所要求的符号键和字符串键形式能够一致地工作,或者已记录受支持的限制和选项。
由索引模型根据 Issue 内容生成。
描述
One of the predominant use cases of this SDK is IMHO writing Rails applications. Therefore it would make sense that this SDK supports Rails conventions as much as much as possible. Unfortunately it doesn't do that currently in term of keys as symbols vs strings.
The desirable version
map_attr :my_data, default_value: { items: [] }
throws an error while, as the syntax required is
map_attr :my_data, default_value: { 'items' => [] }.
Same for ERB:
<% my_data.except(:name).keys.each do |key| %>
does not work but needs to be
<% my_data.except("name").keys.each do |key| %>
This is very un-rails-y, both in models as in views, as using HashWithIndifferentAccess gives you at least both options. If you don't want to support this out of the box due to the dependency to ActiveSupport, I would at least making an option when ActiveSupport is available (or automatically use it).
- 主要语言
- Ruby
- 星标
- 318
- 派生
- 44
- 平均合并
- 2 天 21 小时
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aws/aws-record-ruby 的其他 Issue
-
BuildableSearch#complete!.to_a auto-paginates silently and Limit is per-page (companion to #153)未关闭feature-request
难度 5/5 一周以上 新手友好度 25/100
aws/aws-record-ruby#157 · 2 条评论 ·
-
feature-request
难度 5/5 一周以上 新手友好度 38/100
aws/aws-record-ruby#155 · 1 条评论 ·
-
feature-request p2 queued
难度 4/5 3-5 天 新手友好度 48/100
aws/aws-record-ruby#153 · 2 条评论 ·
-
feature-request
难度 5/5 一周以上 新手友好度 35/100
aws/aws-record-ruby#152 · 3 条评论 ·
-
feature-request
难度 4/5 3-5 天 新手友好度 35/100
aws/aws-record-ruby#147 · 1 条评论 ·
查看 aws/aws-record-ruby 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 85/100
temporalio/sdk-ruby#625 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 94/100
zerocracy/judges-action#2803 ·
维护者通常 5 天内回复
-
empty tone.rb未关闭
难度 1/5 1 小时以内 新手友好度 78/100
-
难度 1/5 1-3 小时 新手友好度 92/100