DEV Community

Cover image for Sinatra Sports App CRUD MVC
John Glennan
John Glennan

Posted on • Updated on

Sinatra Sports App CRUD MVC

I used corneal to generate the file structure for my first Sinatra app. This structure helped me prepare for the long route ahead. I started making sure my active record gem was set to version 5.2. It runs better with sqlite. I then went ahead and created a simple user table and bets table and migrated them using rake. I then made sure my models were in place (user and bet) and inheriting from active records base. My models also have relationships to each other. For example my bet class belongs to users and my users have many bets. I seeded fake data and made sure that my associations were working correctly using my custom rake console. Rake console has helped me a lot especially when I need to look up methods on my created objects. I then began to meticulously use my HTTP verbs I learned, and routed out my controllers and corresponding embedded ruby views. These views present the user with an interface. Running shotgun allows you to visit localhost:9393 where the development site lives. This app allows you to keep track of sports wagers placed on games. I'm proud of how far I've come. This simple app has a lot of potential and plan to continue working on it in the next framework Rails.

Top comments (1)

charlyjazz profile image
Carlos Azuaje

Please take a look my Sinatras projects, maybe can help you !

Music Social App rendered with Sinatra
API REST with Backbone JS App