Class: ProjectRolesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/project_roles_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#after_sign_in_path_for, #api_authenticate!, #current_project, #expire_revision!, #followed_projects, #no_cache, #read_revision, #require_login, #return_or_cache_revision!, #revision, #unfurling?, #with_current_project

Methods included from UrlHelper

#feature_path, #link_to_project_feature

Instance Method Details

#createObject



5
6
7
8
# File 'app/controllers/project_roles_controller.rb', line 5

def create
  Role.where(project_id: @project.id, user_id: current_user.id).first_or_create(name: "Follower")
  redirect_to :back, notice: "You are now following #{@project.name}"
end

#destroyObject



10
11
12
13
# File 'app/controllers/project_roles_controller.rb', line 10

def destroy
  Role.where(project_id: @project.id, user_id: current_user.id).delete_all
  redirect_to :back, notice: "You are no longer following #{@project.name}"
end