Answer the question
In order to leave comments, you need to log in
Display order of fields from last to first added fields to database using SQLite and sinatra?
How to display list of fields from latest to first added fields in database using SQLite and sinatra?
For example, there is such a table:
CREATE TABLE address (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
address TEXT,
tel TEXT
);
the list should look like this:
Address n
.
.
.
Address 10
Address 9
.
.
.
Address 1
1/ What query expression should be in the app.rb file?
2/ What is the form of the code in the index.erb file?
thanks in advance
Answer the question
In order to leave comments, you need to log in
ruby
created_at replaced with the field on which you want to reverse addresses
eruby
- @addresses.each do |a|
= a.name
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question