I have a a .each Do loop in rails which works fine on MySQL but when I upload it to Heroku (and therefore Postgres) it doesn't work correctly.
I want the items to be ordered by time, preferably the most recent at the top. Here's the first bit of code I had:
<% @envelope.transactions('created_at DESC').reverse.each do |transaction|%>
When I noticed the problem with Postgresql I looked around and switched the code to the following, it still seems to work on mysql but it still doesn't work on Heroku:
<% @envelope.transactions(:order=>'DATE(created_at) DESC').reverse.each do |transaction|%>
anyway, I'm at a loss, mostly because I know nothing about databases. how do I get Postgres to respond to my request in Rails 4 to have the most recent ones at the top?
Thanks!
UPDATE:
Here is some sample output as an example of what I'm talking about:
I input 3 things and it put them in correctly:


You can go try it yourself at: http://couplesbudget.herokuapp.com/envelopes/6/edit
username: [email protected] password: test123456
Update2
I recreated the above situation on my dev pc (with mysql) and here is what I got as far as details go:

as you can see envelope 1 is created at 3:25:06 as you can see envelope 2 is created at 3:25:11 as you can see envelope 3 is created at 3:25:19
Here's the data from the edit:

then after the change:
as you can see envelope 1 is created at 3:25:06 as you can see envelope 2 is created at 3:25:11 as you can see envelope 3 is created at 3:25:19
So its not changed. why then does postgresql not order the instances correctly?
@envelope? What is@envelope.transactions?@envelope? What is thistransactionsmethod?