I'm using FriendlyId. At the moment i build a custom slug this way:
class Photo < ActiveRecord::Base
extend FriendlyId
friendly_id :photo_by_author, :use => :slugged
def photo_by_author
"#{title} by #{user_id}"
end
belongs_to :user
end
And my slug it's like: /photo-title-by-7
Instead of 7
I want to get the username
of the user = 7
How can I do this?