リソースからバインドされた属性オプションを持つクラス Deal < ActiveResource があります。Rails コンソールで、options が配列を返すことを確認しました。ただし、define?(オプション) は nil を返します。defined?(:options) が true を返すことに気付きましたが、前の例で nil が返された理由はまだわかりません。
2 に答える
0
I suspect that defined?(options)
is calling the options method and passing the result to defined?
. defined?(:options)
is what you probably want. Providing a code snippet might help in answering more accurately.
于 2013-01-18T19:14:13.393 に答える
0
私が覚えている限り、ActiveResource はmethod_missing
メソッドを使用して小さな魔法を実行します。options
したがって、実際には、メソッドが定義されることを期待すべきではありません。実装を見て、これがどのように機能するかを確認してください。
于 2013-01-18T19:07:55.990 に答える