This project aims at going through all rails specificities through a step by step project. Each steps increments in complexitiy.
- bundle cli
- rails cli
- rails console
- rails server
- Github basics
- Controllers
- Models
- Migrations
- Views
- Partials
- Helpers
- Routing
- Tasks
- Mailers
- Device
- Filtering data
- Slug (to_param, to_slug)
- Class methods
- Object methods
- TDD
- Validations
- relations belongs_to
- relations has_one
- relations has_many
- relations has_and_belongs_to_many
- relation through
- Assets pipeline
- CRF tokens
- Data query (.all, .where, .where.not, .order, etc)
- STI
- Shallow routing
- Destroy cascade
- Destroy nullify
- Create a new project
rails new - Scaffold a resource
Projectwith anameand adescriptionas astring - Validates the presence of
name - Generate a controller
StaticPageswith an actionhome - Change the content of the new action to
Welcome all - Prevent the
destroyaction forProjectmodel (through the routes) - Set
StaticPages#homeas the root of the web app - Add (manually) a new action to the
StaticPagescalledprivacyand accesible via/privacy - Add (manually) a new action to the
StaticPagescalledtermsand accesible via/legal - Add a route to access
StaticPages#terms(Create on last step) via/legal-terms - Add (manually) a new action to the
StaticPagescalledlocationand accesible via/location - Change the action
StaticPages#locationto render a viewmapwhen we try to access/location?view=map - Generate a migration adding the field
ratingas afloatto the modelProject - Add a validation to
Projectmodel to accept onlyratingvalues between1and5included. - Generate a model
Todowith alabelas astringand aprojectas areferences - Look into the new model file to see what was generated
- Look into the
schemafile and look what was generated - Validates the presence of
label - Test within the rails console
- Pretend to scaffold the controller
- Find the right arguments to skip the existing model files
- Add a
has_manyrelation inProjectto show all its relatedTodo - Restrict the access to
Todo#indexin the routing file - Display the
todosof aProjectin theProject#indexendpoint - Generate a migration to add
priorityattribute toTodoas ainteger - Declare this field as an
enuminTodomodel with the possible values of:high,:medium,:low - Add the class method
totaltoProjectin order to getProject.totalreturning the amount of projects in the data base - Add the class method
totaltoTodoin order to getTodo.totalreturning the amount of todos in the data base - The sentence
We currently have n todos within n projectsto the home page. Bothnshould refer to the newly created class methods andtodosandprojectsshould plurialize according to the amount. - Do training (1) listed below if you need a refresh of the points we went trough.
- Scaffold a resource
Taskwith fieldsdoneas aboolean,labelas astring,todoas a reference - Test
labelis present - Test
labelis unique through theTodo - Test
todois required - Test
doneisfalseat creation - Test
Taskgets deleted when we delete parentTodo - Test
projectexists (has_one through) - Test
Taskgets deleted when we delete parentProject - Generate a mailer
ProjectMailerwithnotify_adminsending an email sayingNew project NAME was created. Accese HEREwhere NAME is the name of the project and HERE is a url to the project. - Call the mailer from
project#createwhen the creation is a success - Add a method
open_taskstoTodoreturning the current open tasks in it - Add a method
open_taskstoTodoreturning aboobleanregarding if it still has open tasks - Change the
destroymethod oftodoto raise anStandardErrorwhen we try to delete aTodowith opentasks - Add 3 images representing
:high,:medium,:lowpriority - Display the image corresponding the
priorityof aTodofrom the assets in the corresponding views - Move the code you just wrote to
todos_helper.rb - Add a logo to the
publicfolder and display it on every page
- Scaffold
Milestonewhich as alabel, adeadlineand belongs to aproject - All fields are required to create a
Milestone - In a project the
showview displays all milestones - Order them to see first the next in line (or past if one exists)
- Add
statusattribute to aProjectwith theenumvalues:open,:close - The default status when creating a new project is
:open milestone.active?should returntrueif the project is:openorfalseif the project isn't:open- Scaffold
Labelressource which has alabel, and acolor - Validate the
labelis present - Validate the
coloris in the format#FFFor#FFFFFF.Fbeing an hecadecimal value0-9A-Fa-F - a
Labelcan be part of manyprojectsaProjectcan have manylabels(usehas_and_belongs_to_manyrelation) - Add a column
Labelsin theindexview ofProjectsshowing the amount of labels related to theProject - List all
labelsrelated to theProjectin theshowview ofProjects - The background of a label cell should be the color defined in the label
- List all
projectsrelated to theLabelin theshowview ofLabels - The route
/labelsshould not be accessible anymore - Remove the field
descriptionfrom the project in the interface and the database - The Project field
statusmust be editable through thecreateandeditforms - Display the Project's
ratingin theshowview