Welcome to our coding challenges designed to test your Ruby on Rails expertise. Each challenge focuses on a specific aspect of Rails development, from implementing new features to refactoring existing code. Please select and complete any of the tasks below as instructed.
Objective: Implement a custom scope on the User
model to filter users who have logged in within the last week.
Objective: Add a new RESTful API endpoint to create a Comment
for a Post
.
Instructions: 3. Ensure the controller handles both success and failure cases appropriately.
Objective: Add a validation to the Post
model to ensure the title is unique among posts published in the current year.
Instructions:
- Add a custom validation method in
post.rb
that checks the uniqueness of the title for the current year. - Use this validation only when a new
Post
is created or its title is updated.
Objective: Create a service object to send an email notification when a new user signs up.
Objective: Refactor the provided code in the PostsController
.
Instructions: Ensure the functionality remains intact.