Username
Username

Reputation: 3663

How do I query, update, insert rows into an SQLite database (a .sqlite file) using Sinatra?

I'm used to writing PHP queries to databases (i.e., queries that looks like SQL syntax), but I'm confused on how to do this in Ruby's Sinatra gem.

None of the documentation or tutorials I found online indicate that Sinatra is similar to PHP.

Am I missing something here?

Upvotes: 0

Views: 1095

Answers (1)

Shamaoke
Shamaoke

Reputation: 6282

As far as I understand the matter, Sinatra isn't created for database queries. It's a DSL which makes easier creating applications for getting requests from the web-server and forming responses. To work with databases there are two approaches: using the ruby bindings to a database or using ORMs. The last approach is wide spread and preferable in modern Ruby web-development. Here's the list of ORMs which you can use to work with databases making web-applications in Sinatra:

Upvotes: 3

Related Questions