R
R
Ring-lang2016-05-30 22:05:26
ruby
Ring-lang, 2016-05-30 22:05:26

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

1 answer(s)
F
Fahrenhe17, 2016-05-30
@Ring-lang

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 question

Ask a Question

731 491 924 answers to any question