9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/qm-acts-as-generic-controller-controller.rb', line 9
def acts_as_generic_controller
include InstanceMethods
class_eval <<-END
rescue_from ActionView::MissingTemplate do |exception|
case params[:action].to_sym
when :index
render :template => "generic_controller/index"
when :new, :edit
render :template => "generic_controller/form"
when :show
render :template => "generic_controller/show"
else
raise exception
end
end
before_filter :check_generic_privileges, :only => [ :index, :show, :create, :edit, :update, :destroy ]
before_filter :check_limit_for_user, :only => [ :show, :edit, :update, :destroy ]
END
end
|