Sha256: c77aefdf7d71ae25b054c96b5d930159cb2439590f3891bf3e0606bde600c85c

Contents?: true

Size: 782 Bytes

Versions: 5

Compression:

Stored size: 782 Bytes

Contents

class FamilyGallery::PicturesController < FamilyGallery::ResourcesController
  before_filter :set_group

  def show
    @width = 800
    @height = @picture.height_for_width(@width)

    if @group
      @previous_picture = @picture.previous_picture_in_group(@group)
      @next_picture = @picture.next_picture_in_group(@group)
    end
  end

private

  def set_group
    @group = FamilyGallery::Group.find(params[:group_id]) if params[:group_id]
  end

  def after_assign
    resource_instance.user_uploaded = current_user
    resource_instance.user_owner = current_user
    resource_instance.groups << FamilyGallery::Group.find(params[:group_id]) if params[:group_id].present?
  end

  def resource_params
    params.require(:picture).permit(:title, :description, :image)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
family_gallery-0.0.5 app/controllers/family_gallery/pictures_controller.rb
family_gallery-0.0.4 app/controllers/family_gallery/pictures_controller.rb
family_gallery-0.0.3 app/controllers/family_gallery/pictures_controller.rb
family_gallery-0.0.2 app/controllers/family_gallery/pictures_controller.rb
family_gallery-0.0.1 app/controllers/family_gallery/pictures_controller.rb