Extract profile route helpers to a module
parent
a44121eb7b
commit
9881c5df6c
@ -0,0 +1,15 @@
|
||||
module RouteHelper
|
||||
|
||||
def profile_path(user)
|
||||
if user.username
|
||||
public_profile_path(username: user.username)
|
||||
else
|
||||
unnamed_user_path(user)
|
||||
end
|
||||
end
|
||||
|
||||
def profile_url(user)
|
||||
root_url[0..-2] + profile_path(user)
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue