JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

prevents the use of attributes that match core functions

オープン
#918 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Ruby
スター
2.3k
フォーク
546
PR マージ指標
30日以内にマージされた PR はありません

説明

I'm creating a resource that has a method attribute, but due to the way it works now:

  define_method attr do
    @model.public_send(options[:delegate] ? options[:delegate].to_sym : attr)
  end unless method_defined?(attr)

It fails to work for me. I know method is a core ruby function, but it's also the word used to describe HTTP's GET and PUT.

One option is to simply drop the unless. Allow rewriting, but warn.

Another option is to provide an in and out type option. Currently I would describe delegate as the in, where it describes how to take in the data, and I would provide a key option as the out functionality (what the resulting key will look like).

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

issue に示されている resource 属性の定義から始め、method_defined? が method などの名前に対する生成アクセサーをどのようにブロックしていたかを調べます。衝突を警告付きで上書きするべきか、明示的な出力キーにマッピングするべきかを決定し、選択した挙動のリグレッションカバレッジを追加します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rails, ruby
領域
api, backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。