I need help on how to implement AMISTAD gem in a rails3 application. Please suggest some tutorials or views? I saw github amistad link. but i want a full coverage on this gem. Please help me.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The gem creator kindly send me an example of how to use the GEM try these, create a friendship controller that handles the methods
class FriendshipsController < ApplicationController
before_filter :authenticate_user!
def index
@friends = current_user.friends
@pending_invited_by = current_user.pending_invited_by
@pending_invited = current_user.pending_invited
end
def create
@Friend = User.find(params[:user_id])
@friendship_created = current_user.invite(@Friend)
if @friendship_created
flash.now[:notice] = "Une demande d'amiti a t envoye #{@friend.fullname}"
end
end
def approve
@Friend = User.find(params[:user_id])
@friendship_approved = current_user.approve(@Friend)
@friends = current_user.friends
@pending_invited_by = current_user.pending_invited_by
flash.now[:notice] = "La demande d'amiti de #{@friend.fullname} a t approuve"
end
def remove
@Friend = User.find(params[:user_id])
@friendship = current_user.send(:find_any_friendship_with, @Friend)
if @friendship
@friendship.delete
@removed = true
flash.now[:notice] = "L'amiti avec #{@friend.fullname} a t supprime"
end
end
end