Muck Friends¶ ↑
Installation¶ ↑
The muck friends engine is part of the muck framework and relies upon the muck-engine, muck-users and muck-profiles gems.
These gems should be installed automatically when you install the muck-friends gem. Refer to the documentation for each to setup configuration. The muck-activities gem is optional. If it is installed and enable_friend_activity is true then friend and follow activity will be fed into the user’s activity feeds
Add this to your Gemfile:
gem 'muck-friends'
Add an initializer with the following:
MuckFriends.configure do |config| # Friend Configuration # The friend system provides a hybrid friend/follow model. Either mode can be turned off or both can be enabled # If only following is enabled then users will be provided the ability to follow, unfollow, and block # If only friending is enabled then users will be provided a 'friend request' link and the ability to accept friend requests # If both modes are are enabled then users will be able to follow other users. A mutual follow results in 'friends'. An unfollow # leaves the other party as just a follower. # Note that at least one mode must be enabled. config.enable_following = true # Turn on 'following'. This is similar to the 'follow' functionality on Twitter in that it let's users watch one # another's activities without having explicit permission from the user. A mutual follow essentially becomes a # friendship. config.enable_following = true config.enable_friending = true # Turn on friend system. config.enable_friend_activity = true # If true then friend related activity will show up in the activity feed. Requires muck-activities gem end
Also be sure to configure the other muck gems that muck friends depends on. Look at test/config/initializers/muck.rb for an example.
Usage¶ ↑
You will need a friend model that has ‘include MuckFriends::Models::MuckFriend’ and a user model that has ‘include MuckFriends::Models::MuckUser’
Example¶ ↑
After installing the gem just create a friend model thus:
class Friend < ActiveRecord::Base include MuckFriends::Models::MuckFriend include MuckActivities::Models::MuckActivityConsumer # requires the muck-activities gem end
and a user model thus:
class User < ActiveRecord::Base include MuckUsers::Models::MuckUser include MuckFriends::Models::MuckUser include MuckProfiles::Models::MuckUser include MuckActivities::Models::MuckActivityConsumer # requires the muck-activities gem end
Copyright © 2009-2010 Tatemae, released under the MIT license