Welcome to my next project which is my first Ruby on Rails project, ever. After having experienced my first project writing Ruby for a CLI Gem, then creating a Research Hub with the Sinatra framework, Rails was somewhat magical to me. It definitely elicited tons of “ooohs” and “aaahs” from me.
Step 1 was planning. I already knew what I wanted to create. My idea was to create an e-commerce website for an up and becoming, high-end eyeglasses brand called Gatsby Designs. The entire branding was genius. It would depict the stories from the twentieth century and in some ways, the style as well with but with a touch, slap? of millennials.
I recently was gifted with an Ipad and the first thing I did was associate all of the relationships. I drew everything out and then when it all made sense to me, I proceeded to look through the models and associations to ensure that they fulfilled the project requirements. I even went a step further to give examples of how my app was going to meet these requirements.
After sketching and planning, it was time to build the skeleton of my app. By skeleton, I mean:
- running rails new gatsby_designs
- Creating the migrations for all of the tables that I needed:
- setting up a repository on github and running git init.
- Associating all of my relationships
- Testing out the relationships in rails console
When I was sure that everything was working correctly, I ran rails s and then came a hugggggge problem.
THE BROWSER ISSUE
I had the worst experience with chrome where essentially, it was blocking me from starting a rails server. I wished I had a screenshot of it! It had something to do with the server not being “safe”. It took an entire day and a half of troubleshooting, reading tons of articles, skimming through the Cloud9 support FAQs, and submitting my own questions, until I gave up trying. It was the most frustrating thing since I started this course. Apparently, tons of people were experiencing the same thing, but their solutions were outdated and I had no way to fix this issue until I realized it was midnight and the thought of maybe uninstalling and reinstalling chrome could work.
But wait, it gets better! I followed directions from a website that instructed me on how to “Delete Chrome”. I wanted to purge my Macbook of it and then completely raise it from the dead but without any baggage. This required for me to delete cache files, cookies, anything Chrome related. After purging Chrome from my computer, I reinstalled it. Then this is when it hit me. I DIDN’T BACK UP ANY OF MY CHROME PROFILES!! I use one for school where it contains all of my bookmarks for rails, css, gems,, my environment and every interesting article that I wanted to save for later. I also had one for work as well and another for just personal stuff like banks, shopping etc.
It was now 2 AM and I couldn’t sleep knowing that all of my chrome profiles in which I use for different things are now gone. Most importantly, my bookmarks were gone. I tried for a couple of hours to manipulate files and revive deleted cache files but to no avail. Finally it was around 4:30 AM where I decided to give up and just re-add the bookmarks that I do remember. However, instead of creating profiles that aren’t attached to an email I am now using one profile with folders for different things. I definitely learned my lesson here.
Anyway, I digress. After a hard lesson learned, Chrome was actually connecting me to the rails server! What a relief that was after such a tragedy.
GETTING DOWN TO BUSINESS
It was crunch time!
- Drew routes for statics#homepage
- Designed homepage and added navigation into layout (this was SUPER FUN!)
3. Then it was time to implement some logic! I tackled the Facebook omniauth login page. That was super fun too! My users now have the option to sign in through FB!
4. Added validations for logging in and signing up so that I don’t get bad data!
5. Added a products#index page where I added all of the eyeglasses.
6. Added a products#show page where it offers the user an option to add to cart
7. Added a carts#show page for user to be able to adjust quantity of each line item, delete from cart, and check out.
8. Added a user_orders#index page and a user_order#show page to be able to view all past orders
9. Added a statics#about page and a statics#contact page
10. Added the ability for a user to add products to cart without having to log in until they decide to check out! Once the user logs in, their cart items will merge. So if they already had items in their cart, it won’t replace their existing cart!
11. users can also write reviews!