Sha256: fd0536fd342e804beaef520446eb669cfed6688028e0dea4bf389928094dccdf
Contents?: true
Size: 1.76 KB
Versions: 4
Compression:
Stored size: 1.76 KB
Contents
require_dependency "wafflemix/application_controller" module Wafflemix class Admin::RolesController < ApplicationController layout 'wafflemix/admin' def index @roles = Role.all respond_to do |format| format.html format.json { render json: @roles } end end def show @role = Role.find(params[:id]) respond_to do |format| format.html format.json { render json: @role } end end def new @role = Role.new respond_to do |format| format.html format.json { render json: @role } end end def edit @role = Role.find(params[:id]) end def create @role = Role.new(params[:role]) respond_to do |format| if @role.save format.html { redirect_to [:admin, @role], notice: 'Role was successfully created.' } format.json { render json: @role, status: :created, location: @role } else format.html { render action: "new" } format.json { render json: @role.errors, status: :unprocessable_entity } end end end def update @role = Role.find(params[:id]) respond_to do |format| if @role.update_attributes(params[:role]) format.html { redirect_to [:admin, @role], notice: 'Role was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @role.errors, status: :unprocessable_entity } end end end def destroy @role = Role.find(params[:id]) @role.destroy respond_to do |format| format.html { redirect_to admin_roles_path } format.json { head :no_content } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems