Sha256: 8f3264cc1d469b48bcb69f29892b0115ed38fa018eb05342225093f8b4de60a5

Contents?: true

Size: 551 Bytes

Versions: 6

Compression:

Stored size: 551 Bytes

Contents

class ProjectRolesController < ApplicationController
  before_action :find_project


  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

  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


private

  def find_project
    @project = Project.find_by_slug!(params[:project_id])
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
houston-core-0.8.4 app/controllers/project_roles_controller.rb
houston-core-0.8.3 app/controllers/project_roles_controller.rb
houston-core-0.8.2 app/controllers/project_roles_controller.rb
houston-core-0.8.1 app/controllers/project_roles_controller.rb
houston-core-0.8.0 app/controllers/project_roles_controller.rb
houston-core-0.8.0.pre2 app/controllers/project_roles_controller.rb