Skip to content

Commit

Permalink
Call find using WorkRelation
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Jun 21, 2016
1 parent 6595129 commit bcd4763
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/items_controller.rb
Expand Up @@ -31,7 +31,7 @@ def show
private

def my_load_and_authorize_resource
@work = GenericWork.find(params[:id])
@work = CurationConcerns::WorkRelation.new.find(params[:id])

unless user.can? :edit, @work
return render plain: "#{user} lacks access to #{@work}", status: :unauthorized
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/work_usage.rb
Expand Up @@ -6,7 +6,7 @@ class WorkUsage
attr_accessor :id, :created, :path, :pageviews

def initialize(id)
work = ::GenericWork.find(id)
work = CurationConcerns::WorkRelation.new.find(id)
user = User.find_by(email: work.depositor)
user_id = user ? user.id : nil

Expand Down

0 comments on commit bcd4763

Please sign in to comment.