yakryder / muscle-wizards

Contest prep app
0 stars 1 forks source link

other_user could be refactored #56

Closed dummied closed 8 years ago

dummied commented 8 years ago

https://github.com/SherSpock/muscle-wizards/blob/master/app/controllers/application_controller.rb#L16-L20

If I understand its purpose, something like:

def other_user(user)
  @prep.athlete == user ? @prep.coach : @prep.athlete
end

More than that, I'd be inclined to make it a method on Prep instead.

def other_party(user)
  user == athlete ? coach : athlete
end

Then, when you use this (getting to those in other issues), you can use @prep.other_party(current_user) instead.