Class: Bootsy::ImagesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Bootsy::ImagesController
- Defined in:
- app/controllers/bootsy/images_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 |
# File 'app/controllers/bootsy/images_controller.rb', line 21 def create @gallery = find_gallery @gallery.save! @image = @gallery.images.new(image_params) create_and_respond end |
#destroy ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/bootsy/images_controller.rb', line 29 def destroy @image = Image.find(params[:id]) @image.destroy respond_to do |format| format.json do render json: { id: params[:id] } end format.html { redirect_to images_url } end end |
#index ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/bootsy/images_controller.rb', line 5 def index @gallery = find_gallery @images = @gallery.images respond_to do |format| format.html # index.html.erb format.json do render json: { images: @images.map { |image| image_markup(image) }, form: new_image_markup(@gallery) } end end end |