Sha256: 28d886600a64f6f487b50ea9510902513000d0f9f19be141aa22e4beb763cb8b
Contents?: true
Size: 625 Bytes
Versions: 3
Compression:
Stored size: 625 Bytes
Contents
class Admin::PhotosController < ActionController::Base def sort params[:photo].each_with_index do |id, idx| p = Photo.find(id) p.position = idx p.save end render :nothing => true end def create if params[:product_id].present? parent = Product.find(params[:product_id]) end @photo = parent.photos.build(src: params[:file]) unless @photo.save render js: 'alert("Ошибка! Фото не загружено")' end end def destroy @photo = Photo.find(params[:id]) if @photo.destroy render 'admin/photos/destroy' end end end
Version data entries
3 entries across 3 versions & 1 rubygems