This project was a huge reminder in nested forms and helper methods. While coding my todo app, I was wondering if I could put a form within a form to create a list of items. When I looked back at previous lessons, I was reminded of nested forms. After creating a list with one item, the next challenge was persistence and connecting an item to a list and user correctly. Tux was utilized a lot in order to get this right. I did this by having
<form method="post" action=“/items/new/<%=@list.id%>”>
and
ListItem.create(:description => params[:description], :word_number => params[:word_number], :list_id => params[:id])
The second most important component was helpers methods. They were utilized in the controller and views by displaying certain elements only if a user was logged in. Although the controller didn’t allow users to modify other users’ lists, the helper method of logged_in? made the app more user friendly by having less buttons unnecessarily.
For this portfolio project, I started with the most MVP I could imagine at each iteration.
Having reached a personal coding milestone, I wanted to write about a non-technical topic: learning. So programming will always require beating some learning curve whether it’s with a greenfield or brownfield project. The most important thing about this journey has been having no-zero days. Ultimately, the best way to learn how to code is to code. However, discouragement and doubt can interfere. Below are strategies that have helped me.
Let’s say that we have an array of vegetables that we want to use for our sandwich. Filter would make a new array of vegetables that we do like. Map would be the chopping that happens to each vegetable. Reduce would add all the ingredients to one sandwich or value. However, our original array of vegetables would remain the same. Below are some examples of the copying and manipulation of arrays through map, filter, and reduce methods.