jeudi 2 avril 2015

Best practices concerning SQLite queries, Sinatra, and erb?

I'm building a framework that allows users to install apps to add specific functionalities. The intent is for the user to manage these apps through a small web app. The list of installed apps exists in a sqlite3 database, and I'm using Sinatra to route http requests. I'm using erb templates to design the web pages in question.


My question is, what is the best practice for populating my displayed list of installed apps? Should I make the SQL queries in the Sinatra 'do' block and then pass an array containing the app names over to the erb? Or should I be making the database queries in the erb file itself?


Functionally, I'm sure they are very similar (though if there are functional differences, I'd like to know), but I would like to be following best practices if at all possible :)


Aucun commentaire:

Enregistrer un commentaire