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

Data processing in the model of the blog App #3

Merged
merged 7 commits into from
Dec 2, 2022
Merged

Conversation

iambenkis
Copy link
Owner

Description 🖥️

In this milestone, I set up my model, using the tables for Users, Posts, Comments, and Likes that I created in the previous milestone.

Checklist 💯

Create models ✔️

  • Create model classes for all entities as shown in the ERD diagram.
  • Set up associations between models.

Use models to insert data ✔️

  • Familiarize yourself with 'rails c' command.
  • Open rails console for your project.
  • Create at least one user by running the following code:
       first_user = User.create(name: 'Tom', photo: 'https://unsplash.com/photos/F_-0BxGuVvo', bio: 'Teacher from Mexico.')
       second_user = User.create(name: 'Lilly', photo: 'https://unsplash.com/photos/F_-0BxGuVvo', bio: 'Teacher from Poland.')
  • Create at least 4 posts written by one of the users you created by running the following code:
       first_post = Post.create(author: first_user, title: 'Hello', text: 'This is my first post')
  • Create at least 6 posts comments for one of the posts you created by running the following code:
       Comment.create(post: first_post, author: second_user, text: 'Hi Tom!' )
  • Use other CRUD methods to find, update and delete entities.

Create custom methods ✔️

Your models should include some additional methods.

  • Users
    • A method that returns the 3 most recent posts for a given user.
  • Posts
    • A method that updates the posts counter for a user.
    • A method which returns the 5 most recent comments for a given post.
  • Comments
    • A method that updates the comments counter for a post.
  • Likes
    • A method that updates the likes counter for a post.
  • Go to rails c and check if your methods are working.

Copy link

@sumairq sumairq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @iambenkis ,

Your project is complete! There is nothing else to say other than... it's time to merge it :shipit:
Congratulations! 🎉

Highlights

✔️ Good commit history
✔️Linters are passing
✔️Very professional README
✔️Correct Git flow
✔️Descriptive PR

Optional suggestions

Every comment with the [OPTIONAL] prefix won't stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better. Some of them were simply missed by the previous reviewer and addressing them will really improve your application.

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me in your question so I can receive the notification.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

@iambenkis iambenkis merged commit 58aabb1 into develop Dec 2, 2022
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.

2 participants