Class: Admin::ImagesController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Admin::ImagesController
- Defined in:
- app/controllers/admin/images_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Methods included from BaseHelper
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/controllers/admin/images_controller.rb', line 20 def create @image = Image.new(params[:image]) if @image.save redirect_to admin_images_path else render :new end end |
#destroy ⇒ Object
42 43 44 45 46 |
# File 'app/controllers/admin/images_controller.rb', line 42 def destroy @image = Image.find(params[:id]) @image.destroy redirect_to admin_images_path end |
#edit ⇒ Object
29 30 31 |
# File 'app/controllers/admin/images_controller.rb', line 29 def edit @image = Image.find(params[:id]) end |
#index ⇒ Object
11 12 13 14 |
# File 'app/controllers/admin/images_controller.rb', line 11 def index @search = Image.search(params[:search]) @images = @search.order(:title).page(params[:page]) end |
#new ⇒ Object
16 17 18 |
# File 'app/controllers/admin/images_controller.rb', line 16 def new @image = Image.new end |
#update ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/controllers/admin/images_controller.rb', line 33 def update @image = Image.find(params[:id]) if @image.update_attributes(params[:image]) redirect_to admin_images_path else render :edit end end |