Search code examples
rubysinatradatamapper

how to call select using datamapper


I am trying to call a select statement using datamapper in sinatra. here is the code..

adapter = DataMapper.repository(:default).adapter

adapter.execute("select field3 from db_table where field1 = 'val1' and field2 = 'val2'")

how to scroll through the results. or I want it as a array

thanks


Solution

  • You can use dm-ar-finders plugin which adds support for #find_by_sql method