The project idea was inspired by the Amazon website. I created the ERD (Entity Relationship Diagram) with Lucidchart and google document as my project references. This helped me to identify which generator, model, and CRUD that I need for my project. Then I created a new rails project, local repo, and commit it to Github by using Github Desktop.
rails new shopping-cartgit init
git add .
git commit -m "first commit"
git remote add origin email@example.com:HuydDo/shopping-app.git
git push -u origin master
I created a rails generator to create resource and mode then migrate them.
rails g resource User --no-test-framework
rails g resource Item --no-test-framework
rails d resource User
rails g model Order --no-test-framework
I have spent some time to install Webpacker with Rails 6.0. I have to install Yarn version by:
curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
Open a new terminal to install it and check the version. Then install a webpacker.
//cd shopping-app (master)
I have learned the benefits of using the nested resource, helper methods, and scope when I build my project. It took me a lot of time to understand the nested resource and scope method. I was also able to set up user authentication, including signup, login, logout, and passwords, and log in by Facebook.
It was interesting to learn how to display error messages through in the views and using Flash message in the controllers. I have used DRY by using partials form, helper methods for my views, and create logic in models
I have spent quite some time creating data by using the terminal and checking the data with DB Browser for SQLite. This helped me to understand better how to create data through active record association. I saved time by creating a seed file, and using rails migrate and rails generator commands.
In conclusion, this project helped me to understand how to create the full rails application by using CRUD, nested resource, log in/sign up, log in by different services, create and update data dynamically. I wish I have more time to add additional features to my app such as making payment after checking out the order, add more icons, styling and dynamic response web page.