I can not sort my array in descending order of id.
<%@vendas = Vendas.find(:all,:order=>"id, DESC")%>
I can not sort my array in descending order of id.
<%@vendas = Vendas.find(:all,:order=>"id, DESC")%>
Friend, I do not know how your code works, because the find method requires the ID of the object you want to redeem.
Try to use the new Ruby syntax instead of the rockets. Also try to use spacing to make your code more readable.
The correct code to do what you want is the following:
<% @vendas = Vendas.order("id DESC") %>
Another thing, I recommend moving this line of code to a controller, as it is not good practice to leave the view responsible for tasks like these.
In your controller you could do: @ultimas_vendas = Vendas.order("id DESC")
And in the view just call @nytimes_sales.
It is important to note that an array is not returned, but an ActiveRecord_Relation.
Correct method:
<%@vendas = Vendas.find(:all,:order=>"id DESC")%>