module Popular::Popular::ClassMethods

ClassMethods included in popular models

Attributes

friendship_profile[RW]

Public Instance Methods

after_befriend(*args, &blk) click to toggle source

after_befriend callback convenience class method Fired after a popular_model befriends another popular_model

@example

class User < ActiveRecord::Base
  popular
  after_befriend :do_something_amazing

  def do_something_amazing
    puts name
  end
end

user = User.create name: "Justin"
another_user = User.create name: "Jenny"

user.befriend another_user #=> "Justin"
# File lib/popular/popular.rb, line 240
def after_befriend *args, &blk
  set_callback :befriend, :after, *args, &blk
end
after_unfriend(*args, &blk) click to toggle source

after_unfriend callback convenience class method Fired after a popular_model unfriends another popular_model

@example

class User < ActiveRecord::Base
  popular
  after_unfriend :do_something_amazing

  def do_something_amazing
    puts name
  end
end

user = User.create name: "Justin"
another_user = User.create name: "Jenny"

user.befriend another_user
user.unfriend another_user #=> "Justin"
# File lib/popular/popular.rb, line 173
def after_unfriend *args, &blk
  set_callback :unfriend, :after, *args, &blk
end
before_befriend(*args, &blk) click to toggle source

before_befriend callback convenience class method Fired before a popular model befriends another popular_model

@example

class User < ActiveRecord::Base
  popular
  before_befriend :do_something_amazing

  def do_something_amazing
    puts name
  end
end

user = User.create name: "Justin"
another_user = User.create name: "Jenny"

user.befriend another_user #=> "Justin"
# File lib/popular/popular.rb, line 218
def before_befriend *args, &blk
  set_callback :befriend, :before, *args, &blk
end
before_unfriend(*args, &blk) click to toggle source

before_unfriend callback convenience class method Fired before a popular_model unfriends another popular_model

@example

class User < ActiveRecord::Base
  popular
  before_unfriend :do_something_amazing

  def do_something_amazing
    puts name
  end
end

user = User.create name: "Justin"
another_user = User.create name: "Jenny"

user.befriend another_user
user.unfriend another_user #=> "Justin"
# File lib/popular/popular.rb, line 196
def before_unfriend *args, &blk
  set_callback :unfriend, :before, *args, &blk
end