For my solo Mod 1 Project at Flatiron School, I needed build a CLI app to give a user full CRUD ability, allowing a user to do at least one of each of the CRUD actions. We needed to have a minimum of 3 models, including one join model.
I decided to create a Ski Ticketer app and have my models be User, Ticket, and SkiResort.
My app allows a user to do the following CRUD actions.
Create- Purchase a ski ticket to a ski resort.
Read- View a list of top ski resorts in the world (ski resort names created via Faker).
Update- Edit their name as a user.
Delete- Cancel a ski ticket they've purchased.
Here are a few things I learned from this project:
-Drawing out what the user would see when physically navigating your app can be very helpful for creating the structure of it.
-It's helpful to think of the next step every time you are working on a new method in a CLI app. For example, every time you ask a user a question you have to put a gets.chomp in which will collect the user's input and then you have to do some procedure or routine with that input that represents the feature the user wants. In a CLI app, you have to ask for user input a lot.
-I got better at deleting the db & schema and then remigrating & reseeding when the database got corrupted, as this was something I had to do quite frequently. After doing this, everything will be good and then you'll have data you can test again.
-The SQL logger is a helpful thing to turn on because it shows you what SQL is being run as you write Active Record queries.
-I also learned how to allow a user to exit from the CLI program. This was as simple as setting an elsif statement in a given menu method for the case that the user's selection is a specific number, and then below the if statement you simply type
To install and run this program:
-Fork and clone the repository at this link: https://github.com/kkirby16/mod-1-project
-Open up the terminal in this program and run bundle install in it.
-Next, run rake db:migrate and rake db:seed to create and populate the database.
-Then, run ruby bin/run.rb in the terminal to begin the program.