I am using comfortable_mexican_sofa 2.0.0 in a rails application. I have a table with many rows which displays instances of a model. In my model definition, I have a method which makes a clickable link to a page with some specific data/content related to that instance/record.
class MyModel < ApplicationRecord
def table_button
"<a target='_blank' href='http://localhost:3000/#{self.id}'>link to the page</a>"
end
end
This link should only be displayed if the corresponding page exists. How can I do that ?
First, method to check if the page exists
Second, display the link if the page exists