mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-01-14 12:27:50 -05:00
73 lines
1.3 KiB
Ruby
73 lines
1.3 KiB
Ruby
class RolesController < ApplicationController
|
|
before_filter :authenticate_member!
|
|
load_and_authorize_resource
|
|
|
|
# GET /roles
|
|
def index
|
|
@roles = Role.all
|
|
|
|
respond_to do |format|
|
|
format.html # index.html.erb
|
|
end
|
|
end
|
|
|
|
# GET /roles/1
|
|
def show
|
|
@role = Role.find(params[:id])
|
|
|
|
respond_to do |format|
|
|
format.html # show.html.erb
|
|
end
|
|
end
|
|
|
|
# GET /roles/new
|
|
def new
|
|
@role = Role.new
|
|
|
|
respond_to do |format|
|
|
format.html # new.html.erb
|
|
end
|
|
end
|
|
|
|
# GET /roles/1/edit
|
|
def edit
|
|
@role = Role.find(params[:id])
|
|
end
|
|
|
|
# POST /roles
|
|
def create
|
|
@role = Role.new(params[:role])
|
|
|
|
respond_to do |format|
|
|
if @role.save
|
|
format.html { redirect_to @role, notice: 'Role was successfully created.' }
|
|
else
|
|
format.html { render action: "new" }
|
|
end
|
|
end
|
|
end
|
|
|
|
# PUT /roles/1
|
|
def update
|
|
@role = Role.find(params[:id])
|
|
|
|
respond_to do |format|
|
|
if @role.update_attributes(params[:role])
|
|
format.html { redirect_to @role, notice: 'Role was successfully updated.' }
|
|
else
|
|
format.html { render action: "edit" }
|
|
end
|
|
end
|
|
end
|
|
|
|
# DELETE /roles/1
|
|
def destroy
|
|
@role = Role.find(params[:id])
|
|
@role.destroy
|
|
|
|
respond_to do |format|
|
|
format.html { redirect_to roles_url }
|
|
end
|
|
end
|
|
end
|