Sha256: 7f3b13e0b694158fbc938834403116ea252161630d92055aa5c96750aaed497c

Contents?: true

Size: 565 Bytes

Versions: 1

Compression:

Stored size: 565 Bytes

Contents

class ProjectRolesController < ApplicationController
  before_filter :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

1 entries across 1 versions & 1 rubygems

Version Path
houston-core-0.5.0.beta1 app/controllers/project_roles_controller.rb