app/controllers/works_controller.rb
def load_work
    @work = Work.find_by_id(params[:id])
    unless @work
      raise ActiveRecord::RecordNotFound, "Couldn't find work with id '#{params[:id]}'"
    end
    if @collection && !@work.collections.include?(@collection)
      redirect_to @work and return
    end

    @check_ownership_of = @work
    @check_visibility_of = @work
  end
# only registered users and NOT admin should be able to create new works
only registered users and NOT admin should be able to create new works
only registered users and NOT admin should be able to create new works
def load_work
    @work = Work.find_by_id(params[:id])
    unless @work
      raise ActiveRecord::RecordNotFound, "Couldn't find work with id '#{params[:id]}'"
    end
    if @collection && !@work.collections.include?(@collection)
      redirect_to @work and return
    end
    @check_ownership_of = @work
    @check_visibility_of = @work
  end
def load_work @work = Work . find_by_id ( params [ :id ] ) unless @work raise ActiveRecord :: RecordNotFound , "Couldn't find work with id '#{params[:id]}'" end if @collection && ! @work . collections . include? ( @collection ) redirect_to @work and return end @check_ownership_of = @work @check_visibility_of = @work end
only registered users and NOT admin should be able to create new works
only registered users and NOT admin should be able to create new works