Very simple task but I'm confused...
For example I've the class:
class Test
include DataMapper::Resource
property :id, Serial
property :val1, Integer
property :val2, Integer
end
Is it possible to find all records where val1 = val2 calling Datamapper's #all method?
The
Test.all(:val1 => :val2)
obviously doesn't work.
I want to find solution via #all without direct SQL-query like
repository(:default).adapter.select('SELECT * FROM tests WHERE val1 = val2;')
You could try something like this:
Test.all(:conditions => ['val1 = val2'])