I have a simple ActiveRecord object representing an estimated time of arrival.
class Eta < ActiveRecord::Base
belongs_to :stop
belongs_to :vehicle
validates :timestamp, :presence => true
end
In my database, I created the corresponding columns stop_id, vehicle_id, and timestamp (of type datetime).
I have a rake task set up to perform operations on this table, but it is generating SQL that doesn't make sense. If I try to run:
for eta in Eta.all
puts eta.timestamp
end
It tries to SELECT * FROM eta, however the table is named etas, not eta.
The pluralized database naming is consistent with the rest of the tables created from ActiveRecord objects and I successfully created a similar ActiveRecord object that works correctly.
class PrecedingCoord < ActiveRecord::Base
belongs_to :stop
belongs_to :route
belongs_to :coord
end
In the rake file:
for eta in PrecedingCoord.all
puts eta.coord.latitude
end