We briefly got an overview on setting up tests with RSpec. The syntax was a little strange to me, and I’m realizing I really need to dive back into older things we covered just to ensure I’ve got a good grasp of everything. I won’t have a chance to do that this weekend since I have to work like crazy on my second project, but once that’s done with, I’m looking forward to reviewing things we covered earlier.
Later we did a few exercises with many to many relationship models. I understand the concept, it’s just the actual use of this is something that will take some time for me struggling on the side with it.
Once the lessons were over with, I worked like crazy on my homework assignment. Here’s a screenshot of the welcome view:
I had a lot of fun putting it together, but I probably spent more time than necessary styling it. And now I’m off to start working on my second project, so hopefully I”ll be off to a good start.
Today was another Ruby on Rails day, and I found myself feeling a bit of a low about my coding. Although I understood a chunk of what we covered with CRUD, I decided to start brainstorming ideas for my next project and found myself doubting myself. I wondered, would I actually be able to pull off a good project?
Other graduates of the program have told me that it’s perfectly normal to feel these highs and lows. Some days you feel like you’re really mastering everything while other days you have no idea what you’re doing. The trick is to power through those days when you’re feeling down about your coding, because soon enough you’ll feel good about it again.
Working on associations and ActiveRecord is actually pretty fun. Today was a lab day, so for the entire day I coded away on a Pokemon lab app and a Landlord app. I didn’t bother putting in too much extra work with the Pokemon one, but I had some fun with styling and creating more dynamic drop downs for the landlord one. The apps focused on searching records, the association between records, and being able to add, update, and delete records. Seeing CRUD in action made it make a lot more sense to me.
One cool thing I learned today? The dependent destroy association, where you can delete all records of a table that are related to the record of another table. It was definitely a very cool moment realizing there was a simple way to resolve an issue I had. The more I delve into this whole coding thing, the hungrier I get to learn more. I’m excited to see how much progress I make next week. I never thought I’d understand CRUD so well, and with every repetitive line of code I write for these assignments, the more it sinks in.
Next we reviewed CRUD with ActiveRecord and Sinatra. The instructor walked us through setting up basic adding, deleting, and editing items in a simple Sinatra app. Then we worked on tackling the same work-flow, and later the class broke to begin working on a CRUD lab as well as another CRUD-related homework assignment.
One thing I’m noticing is that this bootcamp definitely gives you your fair share of highs and lows. Sometimes there are highs when you’ve managed to solve a problem creatively. Other times there are lows when you haven’t been able to figure something out. I guess the moral of the story is to keep at it when you’re having a low, because soon enough you will get another high.
We covered a lot of ground with Sinatra that reminded me of rails back when I took the back-end web development course at GA, dealing with views and embedding Ruby code in html templates.
We reviewed REST, otherwise known as REpresentational State Transfer, which refers to the way browsers interact with servers. This includes the five main methods: GET, POST, PUT, PATCH, and DELETE. We also learned about how query parameters can be set up in web applications where you pass in dynamic params.
The rest of the day involved working with ActiveRecord and Sinatra. Overall, understanding the structure of prepping files in Sinatra will take a little bit of review for me. There are some strange conventions involved with naming files and requiring other files, that will only take a matter of time before they are second nature to me.
The rest of the day we delved into Active Record which was actually a lot of fun, where we learned about object-relational mapping. We played around with making queries and setting up new databases. Setting up Active Record does involve a number of steps that are somewhat confusing like putting together the models and database connections. In general it was pretty interesting seeing how to set up database schemas and seeding the databases.
We used AR to perform CRUD actions that include create, new, save, all, find, find_by, where, update, and destroy. I learned about how to connect to the database with postresql in order to actually get the queries to work. And the instructors discussed how convention is more important than configuration, and the conventions are a bit odd, it will take some time to get used to which ones are singular, plural, snake case, and camel case. Here’s an overview of the conventions covered:
- Model file names are singular and snake case
- Model class names are singular and camel case
- Database schema is plural
Overview of the methods covered:
- Class methods include all, new, first, last, and find
- Instance methods include attr_accessors, destroy, save, and update