Class: FollowingsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/followings_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



4
5
6
7
# File 'app/controllers/followings_controller.rb', line 4

def create
  @following = current_user.followings.create(followed: followed)
  redirect_to followed, notice: "Agora você está observando #{followed.name}!"
end

#destroyObject



8
9
10
11
12
# File 'app/controllers/followings_controller.rb', line 8

def destroy
  @following = current_user.followings.find_by_followed_id!(followed.id)
  @following.destroy
  redirect_to followed, notice: "Você deixou de observar #{followed.name}!"
end