Module: Authentasaurus::PermissionsController::InstanceMethods

Defined in:
lib/authentasaurus/permissions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/authentasaurus/permissions_controller.rb', line 35

def create
	@permission = Permission.new params[:permission]
	
	respond_to do |format|
		if @permission.save
			format.html { redirect_to :action=>:index, :notice => "Permission created" }
		else
			flash.now[:alert] = I18n.t(:create_failed, :scope => [:authentasaurus, :messages, :permissions])
			format.html { render :new }
		end
	end
end

#destroyObject



70
71
72
73
74
75
76
77
# File 'lib/authentasaurus/permissions_controller.rb', line 70

def destroy
	@permission = Permission.find params[:id]
	@permission.destroy
	
	respond_to do |format|
		format.html { redirect_to :action=>:index }
	end
end

#editObject



48
49
50
51
52
53
54
# File 'lib/authentasaurus/permissions_controller.rb', line 48

def edit
	@permission = Permission.find params[:id]
	
	respond_to do |format|
		format.html
	end
end

#indexObject



11
12
13
14
15
16
17
# File 'lib/authentasaurus/permissions_controller.rb', line 11

def index
	@permissions = Permission.find :all
	
	respond_to do |format|
		format.html
	end
end

#newObject



27
28
29
30
31
32
33
# File 'lib/authentasaurus/permissions_controller.rb', line 27

def new
	@permission = Permission.new
	
	respond_to do |format|
		format.html
	end
end

#showObject



19
20
21
22
23
24
25
# File 'lib/authentasaurus/permissions_controller.rb', line 19

def show
	@permission = Permission.find params[:id]
	
	respond_to do |format|
		format.html
	end
end

#updateObject



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/authentasaurus/permissions_controller.rb', line 56

def update
	@permission = Permission.find params[:id]
	
	respond_to do |format|
		if @permission.update_attributes(params[:permission])
			flash.now[:notice] = "Permission updated"
			format.html { redirect_to :action => :index }
		else
			flash.now[:alert] = I18n.t(:update_failed, :scope => [:authentasaurus, :messages, :permissions])
			format.html { render :edit }
		end
	end
end