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
Project
with aname
and adescription
as astring
- Validates the presence of
name
- Generate a controller
StaticPages
with an actionhome
- Change the content of the new action to
Welcome all
- Prevent the
destroy
action forProject
model (through the routes) - Set
StaticPages#home
as the root of the web app - Add (manually) a new action to the
StaticPages
calledprivacy
and accesible via/privacy
- Add (manually) a new action to the
StaticPages
calledterms
and accesible via/legal
- Add a route to access
StaticPages#terms
(Create on last step) via/legal-terms
- Add (manually) a new action to the
StaticPages
calledlocation
and accesible via/location
- Change the action
StaticPages#location
to render a viewmap
when we try to access/location?view=map
- Generate a migration adding the field
rating
as afloat
to the modelProject
- Add a validation to
Project
model to accept onlyrating
values between1
and5
included. - Generate a model
Todo
with alabel
as astring
and aproject
as areferences
- Look into the new model file to see what was generated
- Look into the
schema
file 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_many
relation inProject
to show all its relatedTodo
- Restrict the access to
Todo#index
in the routing file - Display the
todos
of aProject
in theProject#index
endpoint - Generate a migration to add
priority
attribute toTodo
as ainteger
- Declare this field as an
enum
inTodo
model with the possible values of:high
,:medium
,:low
- Add the class method
total
toProject
in order to getProject.total
returning the amount of projects in the data base - Add the class method
total
toTodo
in order to getTodo.total
returning the amount of todos in the data base - The sentence
We currently have n todos within n projects
to the home page. Bothn
should refer to the newly created class methods andtodos
andprojects
should plurialize according to the amount. - Do training (1) listed below if you need a refresh of the points we went trough.
- Scaffold a resource
Task
with fieldsdone
as aboolean
,label
as astring
,todo
as a reference - Test
label
is present - Test
label
is unique through theTodo
- Test
todo
is required - Test
done
isfalse
at creation - Test
Task
gets deleted when we delete parentTodo
- Test
project
exists (has_one through) - Test
Task
gets deleted when we delete parentProject
- Generate a mailer
ProjectMailer
withnotify_admin
sending an email sayingNew project NAME was created. Accese HERE
where NAME is the name of the project and HERE is a url to the project. - Call the mailer from
project#create
when the creation is a success - Add a method
open_tasks
toTodo
returning the current open tasks in it - Add a method
open_tasks
toTodo
returning abooblean
regarding if it still has open tasks - Change the
destroy
method oftodo
to raise anStandardError
when we try to delete aTodo
with opentasks
- Add 3 images representing
:high
,:medium
,:low
priority - Display the image corresponding the
priority
of aTodo
from the assets in the corresponding views - Move the code you just wrote to
todos_helper.rb
- Add a logo to the
public
folder and display it on every page
- Scaffold
Milestone
which as alabel
, adeadline
and belongs to aproject
- All fields are required to create a
Milestone
- In a project the
show
view displays all milestones - Order them to see first the next in line (or past if one exists)
- Add
status
attribute to aProject
with theenum
values:open
,:close
- The default status when creating a new project is
:open
milestone.active?
should returntrue
if the project is:open
orfalse
if the project isn't:open
- Scaffold
Label
ressource which has alabel
, and acolor
- Validate the
label
is present - Validate the
color
is in the format#FFF
or#FFFFFF
.F
being an hecadecimal value0-9A-Fa-F
- a
Label
can be part of manyprojects
aProject
can have manylabels
(usehas_and_belongs_to_many
relation) - Add a column
Labels
in theindex
view ofProjects
showing the amount of labels related to theProject
- List all
labels
related to theProject
in theshow
view ofProjects
- The background of a label cell should be the color defined in the label
- List all
projects
related to theLabel
in theshow
view ofLabels
- The route
/labels
should not be accessible anymore - Remove the field
description
from the project in the interface and the database - The Project field
status
must be editable through thecreate
andedit
forms - Display the Project's
rating
in theshow
view