views:

49

answers:

2

I am working on a sinatra app with datamapper connected to a mysql database and am having problems retrieving/finding records from only one specific table. I can insert into it with datamapper find but when I try to do @sleepEntries = Sleep_Log.all I get the following error: ArgumentError: argument out of range. When I load everything into irb I get the same error. I also turned on the ability to see the queries and I get back SELECT id, start_time, length, timestamp FROM sleep_logs ORDER BY id when I call Sleep_Log.all. When I connect to the mysql database through the mysql command line tool I can confirm that there are entries in that table. When I run the query that datamapper is erroring out on I have no problem getting the results. Here is my datamapper model info for Sleep_Log

class Sleep_Log
  include DataMapper::Resource

  property :id, Serial
  property :start_time, Time, :required => true
  property :length, Integer, :required => true
  property :timestamp, DateTime, :writer => :private

  belongs_to :user
end

This is what the table looks like in the database accessed through describe sleep_logs; alt text

What is weird is that retrieve results from all other tables.

The backtrace from irb alt text

A: 

Can you provide a full backtrace?

solnic
The backtrace from when I run it in irb is in my edit above
Ben