Reputation: 3663
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
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:
ActiveRecord (which itself is the part of Ruby on Rails but you can use it outside the framework)
Upvotes: 3