Class: FollowsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- FollowsController
- Defined in:
- app/controllers/follows_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /:username/follow.
-
#destroy ⇒ Object
DELETE /:username/follow.
-
#followed ⇒ Object
GET /:username/followed.
-
#index ⇒ Object
GET /:username/follows.
Instance Method Details
#create ⇒ Object
POST /:username/follow
15 16 17 18 |
# File 'app/controllers/follows_controller.rb', line 15 def create Observe.create!(from_user: current_user, to_user: @user) redirect_to "/" + params[:username] end |
#destroy ⇒ Object
DELETE /:username/follow
21 22 23 24 |
# File 'app/controllers/follows_controller.rb', line 21 def destroy Observe.find_by(from_user: current_user, to_user: @user).destroy redirect_to "/" + params[:username] end |
#followed ⇒ Object
GET /:username/followed
10 11 12 |
# File 'app/controllers/follows_controller.rb', line 10 def followed @observes = @user.observed_users end |
#index ⇒ Object
GET /:username/follows
5 6 7 |
# File 'app/controllers/follows_controller.rb', line 5 def index @observes = @user.observe_users end |