Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logan white #290

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Logan white #290

wants to merge 12 commits into from

Conversation

SoslyLW
Copy link

@SoslyLW SoslyLW commented Jan 30, 2024

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 and create (for article creation)
  • edit and update (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 and content 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, and updated_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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant