DataMapperクラスのメソッドを再利用しようとしています。これもルビーの質問かもしれません。
class Foo
include DataMapper::Resource
property :name
property ...
def self.special_name
self.all(:name => 'whatever')
end
end
class Bar
include DataMapper::Resource
property :name
property ...
def self.special_name
self.all(:name => 'whatever')
end
end
したがって、同じ結果を取得したいので、メソッドspecial_nameを両方のクラスに使用します。ただし、「all」などのDataMapperメソッドも使用します。では、これをどのように行いますか?
どうも