It has officially been a month (as of yesterday) since I started coding at Flatiron School. While I know I could've gone the self-taught route due to the research and DIY skills I've used in the past, I do not regret coding boot camp for a second. I would have never been able to build a full web application with the MVC structure I used for this app just two months in had I been teaching myself.
When I arrived at the second project assignment, the requirements were to make an MVC, CRUD app that has at least a User class with a has_many relationship to one other class that belongs_to a user. After learning the basics of SQL queries, we learned how to use ActiveRecord along with Sinatra. We had to use ActiveRecord to store (CRUD) content that the user creates and prevent other users from changing another user's info.
Planning the App
I knew I wanted to create an application that dealt with organization skills, so I decided to create a task app. I know these have been done time and time again, but I wanted to try my hand at making a complex (for my current ability) app that was practical. For my application, I wanted to make it group-based rather than personal. Therefore, I decided to set up four classes: User, Group, Task, and Todo. A user would have many groups and groups would have many users, so I also implemented a join table with a class Membership that would store group members. I separated "todos" from "tasks" so that tasks could have subtasks (AKA todos). That way a user could choose to create a complex task with many parts, or even just create list items (like on a grocery list) out of todos.
Coding the App
While actually building the application, I realized I had to do some research on concepts we hadn't learned yet since my project set up went beyond the basic requirements. I ran into issues trying to figure out how to differentiate between owners and members in groups so I decided to tackle the problem by using the foreign key "owner_id" in the group migration so that my user and groups class had the lines:
#User class has_many :owned_groups, foreign_key: "owner_id", class_name: "Group" has_many :memberships has_many :groups, through: :memberships #Group class belongs_to :owner, class_name: "User" has_many :memberships has_many :members, through: :memberships, source: :user
I also had to use nested routes in my application to view tasks that were under a specific group, so I researched how that was done in a RESTful manner. Once I had the associations all set up, it was a matter of coding the HTML and then teaching myself some bootstrap to get some nice, responsive design on each page.
This was my far the most time I've spent on something since beginning to code. I'm still not sure every part of it is the way it's supposed to be coded conventionally since a quite a few of the concepts I used I self-taught and I'm just beginning to learn, but I am pretty proud that it functions and the code seems clean to me based on my current knowledge. Just like the previous project, I look forward to returning to this project in the future and reflecting on how far I've come and how much cleaner my code has become. I also hope to be able to create more niche and original projects in the future. But for now, I am proud and excited to continue learning and building.