Has_friendship

screenshot of Has_friendship
rails

Add friendship to ActiveRecord models

Overview

HasFriendship is an innovative gem designed to enhance your ActiveRecord models by enabling seamless friendship functionalities. Whether you're developing a social networking application or simply want to incorporate friend management features, HasFriendship provides the necessary tools to facilitate sending, accepting, and declining friend requests effortlessly. With its self-referential polymorphic association, this gem makes it easy for developers to manage user relationships directly within their models.

Getting started with HasFriendship is a breeze. By simply adding has_friendship to your ActiveRecord model, you can unlock a range of features that simplify the management of friendships. The gem also includes a Rake task to install necessary migrations, ensuring integration into your project is smooth and painless.

Features

  • Quick Setup: Integrate friendship features into any ActiveRecord model by just adding a single line of code, has_friendship.

  • Friendship Management: Users can easily send, accept, and decline friend requests, providing a straightforward way to manage relationships.

  • Blocking Feature: Implement a blocking mechanism to prevent specific users from sending requests or removing friendships, enhancing user experience and safety.

  • Friendship Types: Easily categorize and access friends with four distinct types: requested friends, pending friends, blocked friends, and confirmed friends.

  • Custom Validations: Tailor friendship logic by implementing a friendship_errors method in your Friendable model for more control over how friendships are established.

  • Callbacks Support: Utilize built-in callbacks to trigger custom methods during friendship operations, adding flexibility to your application.

  • Migration Support: Automatically generate and manage the friendship table migration with an easy-to-use Rake task.

  • Testing Framework: Includes RSpec for running tests, ensuring the gem works seamlessly with your chosen versions of Rails and maintaining compatibility across different environments.

rails
Ruby on Rails

Ruby on Rails, often referred to as Rails, is an open-source web application framework written in Ruby. Known for its convention over configuration and don't repeat yourself (DRY) principles, Rails simplifies and accelerates the development of database-backed web applications.