Hello everyone!
A couple of months ago, when I first started with Rails, I took a loooong time to get all the setup and configuration. So, fret not if this happens to you :) I still have a long way to go, but it seems some of the stuff do get easier! So, let’s see how’s the todo app for now…
Steps:
- Generate controller and model for Task with the functions of CRUD (Create, Read, Update, Delete)
$ rails generate controller Tasks index edit show new
$ rails generate model Task name:string userid:integer
- Remove file public/index.html
- Edit routes.rb to connect root to task/index and added general routing
TodoApp::Application.routes.draw do
root :to => "tasks#index"
resources :tasks
end
- Edit
tasks\_controller.rb
to include index, show, edit, destroy, create, new functions
**Referred tutorials: **
- a simple CRUD `. Create a blog with rails
Tools used:
- Stackoverflow for many similar questions & their answers
- Annonate Gem Rails Plugin to automatically add model comments
Concepts learnt:
Tips & Tricks:
- Cut and Paste the error messages into Google or else!!!
- Advanced Google Search -> Select Past One Year to ensure latest version answers
- When deleting a file, do remove it from git as well
$ git rm file-to-delete.rb
Time Taken: 4 hours [it wasn’t even 4 hours when I first tried following a tutorial! It was around 10 hours :) ]
Fun Stuff completed: Todo now has the functions of CRUD (Create, Read, Update, Delete)
peer into the code, play with the app
Next Objective: Build a “Done” Column/field for each task with a checkbox to update it’s status when the task is completed!