I have a notices
model which contains records of notices for each user. Each notice
record contains a message
which is a text field with the notice message. These messages look like:
"#{current_user.username} liked your photo '#{@photo.name}."
In the example above, I would like the user and the photo to also be hyperlinks to that user and photo.
Here is a snippet from my likes_controller
which generates a notice
when a new like
is created:
class LikesController < ApplicationController
def create
@photo = Photo.find(params[:id])
@like = Like.new(:photo_id => @photo.id, :user_id => current_user.id)
if @like.save
@notice = Notice.new(:user_id => @photo.user_id, :message => "#{current_user.username} liked your photo '#{@photo.name}'
end
Any thoughts on how I can include links in the message; is this even possible? Thanks.