Skip to content

Commit

Permalink
Stock meta images
Browse files Browse the repository at this point in the history
  • Loading branch information
Shpigford committed Aug 20, 2024
1 parent e76ac84 commit a770cd5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/models/stock.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
class Stock < ApplicationRecord
include MetaImage

def to_param
symbol
end

private

def create_meta_image
super("#{symbol} Stock")
end
end
1 change: 1 addition & 0 deletions app/views/stocks/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<%
title "#{@stock.symbol} Stock Price, Information and News (#{@stock.name}) - Stocks"
description "#{@stock.symbol} Stock Price, Information and News (#{@stock.name}) - Stocks"
meta_image @stock.meta_image_url if @stock.meta_image_url.present?
%>

<div class="flex justify-between text-sm">
Expand Down
3 changes: 3 additions & 0 deletions lib/tasks/maintenance.rake
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ namespace :maintenance do
Tool.all.each do |tool|
tool.touch
end
Stock.all.each do |stock|
stock.touch
end
end
end

0 comments on commit a770cd5

Please sign in to comment.