Sha256: c8448e6c2e8ae3c048617d211c4099b1500daec41e129b22369cc0e9694cea87

Contents?: true

Size: 605 Bytes

Versions: 4

Compression:

Stored size: 605 Bytes

Contents

class FamilyGallery::MultiplePicturesController < FamilyGallery::BaseController
  before_filter :set_group_and_auth

  def new
  end

  def create
    picture_params[:files].each do |file|
      picture = FamilyGallery::Picture.new
      picture.groups << @group
      picture.image = file
      picture.save!
    end

    redirect_to @group
  end

private

  def set_group_and_auth
    @group = FamilyGallery::Group.find(params[:group_id])
    authorize! :create, FamilyGallery::Picture.new(groups: [@group])
  end

  def picture_params
    params.require(:multiple_pictures).permit(files: [])
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
family_gallery-0.0.7 app/controllers/family_gallery/multiple_pictures_controller.rb
family_gallery-0.0.6 app/controllers/family_gallery/multiple_pictures_controller.rb
family_gallery-0.0.5 app/controllers/family_gallery/multiple_pictures_controller.rb
family_gallery-0.0.4 app/controllers/family_gallery/multiple_pictures_controller.rb