Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds an Encyclopedia system with the ability to create, read, update, and delete articles as well as search functionality to find articles based on title or content.
Controller changes
When creating the article class, the standard controller definitions were created including:
index
(for the root view)show
(for article detail viewing)new
andcreate
(for article creation)edit
andupdate
(for article editing)destroy
(for article deletion)In addition to these definitions, a private
article_params
definition was created to limit the types of parameters that can be passed to the article controller.Attributes Added
The article class was created and has the following 4 attributes:
title
(string)content
(text)author
(text)date
(date)When creating a new article or modifying an existing one, all 4 of these attributes can be changed. Input validation is done through the article class and the limits of the input form fields used when modifying the data.
As per the given test cases, only the
title
andcontent
are required (hence the validation in the controller) and searchable fields.Database Changes
As part of creating the article class, an articles table was created in the local rails environment. This table contains fields for all 4 attributes added as well as default columns such as
id
,created_at
, andupdated_at
.Views added
To support the standard CRUD actions, the following views were added:
index.html.erb
(serves as the root destination and lists all articles in the encyclopedia)show.html.erb
(displays all details about the associated article)_form.html.erb
(while not techinically a view in itself, this form serves as the base for both the new and edit views and holds all input fields for article attributes)new.html.erb
(uses the attribute partial_form
to create a new article)edit.html.erb
(uses the attribute partial_form
to modify an existing article)