I need generate a variable for send a the view, for example i have this:
def after_find
unless self.photo.nil?
if File.exist?(Rails.root + 'public/uploads/tournaments/' + self.photo)
self.photo = '/uploads/tournaments/' + self.photo
else
self.photo = "http://placehold.it/250x400"
end
else
self.photo = "http://placehold.it/250x400"
end
end
It runs well that variable is an attribute of db migration,the problem is when I declare something that is not an attribute of db migration
self.variable1 = "hello world"