Ruby on Rails Saturday, January 1, 2011

Hi all,

I've got a database of events, and (possibly foolishly) I've got column
names such as eventDate, with capital letters. When I want to order the
list of events by their date, I use the line:


@ed_ten_events = AllEvent.where(:city_location => 'Edinburgh',
:ten_event => true).order('eventDate ASC')


This works fine on the local server, but on Heroku it crashes. The logs
reveal that the Heroku Server is being searched with the wrong column
name, one without capitals


ActionView::Template::Error (PGError: ERROR: column "eventdate" does
not exist
LINE 1: ..._events"."city_location" = 'Edinburgh') ORDER BY eventDate
...

Somewhere along the way eventDate is being changed to eventdate, and
this is messing up the search.
I've tested this using columns that don't contain capital letters and it
works fine. So as far as I can tell, my database of events is still
working.

Is there any way of forcing the Heroku 'order' search to keep the
capitals?

Or do I need to change all my columns?

If I have to change columns, is there any way of keeping all the data?

Thanks in advance,

Mike

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment