Class: Poodle::AdminController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Poodle::AdminController
- Defined in:
- app/controllers/poodle/admin_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
33 34 35 36 37 38 |
# File 'app/controllers/poodle/admin_controller.rb', line 33 def create obj = @options[:class].new obj.assign_attributes(permitted_params) instance_variable_set("@#{@options[:item_name]}", obj) save_resource(obj) end |
#destroy ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/poodle/admin_controller.rb', line 47 def destroy obj = @options[:class].find(params[:id]) obj.destroy get_collections (@options[:messages][:delete], :success) respond_to do |format| format.js { render :index } end end |
#edit ⇒ Object
27 28 29 30 31 |
# File 'app/controllers/poodle/admin_controller.rb', line 27 def edit obj = @options[:class].find(params[:id]) instance_variable_set("@#{@options[:item_name]}", obj) render_list end |
#index ⇒ Object
11 12 13 |
# File 'app/controllers/poodle/admin_controller.rb', line 11 def index get_collections end |
#new ⇒ Object
21 22 23 24 25 |
# File 'app/controllers/poodle/admin_controller.rb', line 21 def new obj = @options[:class].new instance_variable_set("@#{@options[:item_name]}", obj) render_list end |
#show ⇒ Object
15 16 17 18 19 |
# File 'app/controllers/poodle/admin_controller.rb', line 15 def show obj = @options[:class].find(params[:id]) instance_variable_set("@#{@options[:item_name]}", obj) render_list end |
#update ⇒ Object
40 41 42 43 44 45 |
# File 'app/controllers/poodle/admin_controller.rb', line 40 def update obj = @options[:class].find(params[:id]) obj.assign_attributes(permitted_params) instance_variable_set("@#{@options[:item_name]}", obj) save_resource(obj) end |