Skip to content

Commit

Permalink
use custom opengraph image for newsletter posts
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmolnar committed Dec 7, 2023
1 parent fb989d4 commit c85b302
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
1 change: 1 addition & 0 deletions _import-this-week-in-rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def markdown_render
title: "#{hey_world_email.title}"
categories: news
author: #{hey_world_email.author}
og_image: assets/images/this-week-in-rails.png
published: true
date: #{hey_world_email.date}
---
Expand Down
21 changes: 11 additions & 10 deletions _posts/2023-11-24-this-week-in-rails.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ layout: post
title: "ErrorReporter#unexpected, with_routing test helpers and more!"
categories: news
author: vipulnsward
og_image: assets/images/this-week-in-rails.png
published: true
date: 2023-11-24
---


Happy Thanksgiving weekend everyone! This is [Vipul](https://www.saeloun.com/team/vipul) bringing you the latest from this week's changes in the Rails codebase.

[ErrorReporter#unexpected to report in production but raise in development](https://github.com/rails/rails/pull/49951)
[ErrorReporter#unexpected to report in production but raise in development](https://github.com/rails/rails/pull/49951)
This change adds `ErrorReported#unexpected` to report precondition violations.

For example:
Expand All @@ -27,26 +28,26 @@ For example:

The above will raise an error in development and test, but only report the error in production.

[Make with_routing test helper work for integration tests](https://github.com/rails/rails/pull/49819)
[Make with_routing test helper work for integration tests](https://github.com/rails/rails/pull/49819)
[`with_routing`](https://api.rubyonrails.org/classes/ActionDispatch/Assertions/RoutingAssertions.html#method-i-with_routing) test helper support has now been added to `ActionDispatch::IntegrationTest` to allow usage in integration tests.

[Support nested elements inside button tag in Active Storage uploads](https://github.com/rails/rails/pull/48290)
This change addresses a potential issue that could arise when a button or an input of type submit contains child elements, such as spans, icons, or other HTML elements.
[Support nested elements inside button tag in Active Storage uploads](https://github.com/rails/rails/pull/48290)
This change addresses a potential issue that could arise when a button or an input of type submit contains child elements, such as spans, icons, or other HTML elements.

[Remove deprecations](https://github.com/rails/rails/pull/50144)
[Remove deprecations](https://github.com/rails/rails/pull/50144)
This PR is an ongoing effort to remove all deprecated code, marked as deprecated for Rails 7.2. Checkout the PR for all things going away and if you are handling them already!

[Handle case in MySQL where the ActiveRecord.db_warnings_action is not called even when a DB query has warnings ](https://github.com/rails/rails/pull/50049)
This change handles cases where MySQL returns `warning_count` greater than zero, but returns no warnings when the `SHOW WARNINGS` query is executed,
[Handle case in MySQL where the ActiveRecord.db_warnings_action is not called even when a DB query has warnings ](https://github.com/rails/rails/pull/50049)
This change handles cases where MySQL returns `warning_count` greater than zero, but returns no warnings when the `SHOW WARNINGS` query is executed,
`ActiveRecord.db_warnings_action` proc will still be called with a generic warning message rather than silently ignoring the warning(s).

[Delay validation of registered Active Record adapters and allow aliasing of adapters ](https://github.com/rails/rails/pull/50093)
This change is from an ongoing effort to allow aliasing of DB adapters by name. The end state here is to allow `mysql` to be mapped to either `trilogy` or `mysql2` at an application level.
[Delay validation of registered Active Record adapters and allow aliasing of adapters ](https://github.com/rails/rails/pull/50093)
This change is from an ongoing effort to allow aliasing of DB adapters by name. The end state here is to allow `mysql` to be mapped to either `trilogy` or `mysql2` at an application level.

[Fix `ActiveStorage::Representations::ProxyController` not returning the proper
preview image variant for previewable files.](https://github.com/rails/rails/pull/50098)

_You can view the whole list of changes [here](https://github.com/rails/rails/compare/@%7B2023-11-18%7D...main@%7B2023-11-24%7D)._
_You can view the whole list of changes [here](https://github.com/rails/rails/compare/@%7B2023-11-18%7D...main@%7B2023-11-24%7D)._
_We had [20 contributors](https://contributors.rubyonrails.org/contributors/in-time-window/20231118-20231124) to the Rails codebase this past week!_

Until next time!
Expand Down
12 changes: 6 additions & 6 deletions _this-week-in-rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def fetch_merged_prs(start_date, end_date, page)

# The two spaces before line-breaks creates a soft-break in the Rails website.
post_content << <<~POST
[#{item["title"]}](#{item["html_url"]})
#{summary.squeeze("\n").lstrip.split("\n")[0..2].join("\n ").lstrip}
[#{item["title"]}](#{item["html_url"]})
#{summary.squeeze("\n").lstrip.split("\n")[0..2].join("\n ").lstrip}
POST
end
Expand All @@ -100,6 +100,7 @@ def fetch_merged_prs(start_date, end_date, page)
title: "TODO: add a title"
categories: news
author: #{author}
og_image: assets/images/this-week-in-rails.png
published: true
date: #{end_date}
---
Expand All @@ -112,16 +113,15 @@ def fetch_merged_prs(start_date, end_date, page)
)

footer = %(
_You can view the whole list of changes [here](https://github.com/rails/rails/compare/@%7B#{start_date}%7D...main@%7B#{end_date}%7D)._
_You can view the whole list of changes [here](https://github.com/rails/rails/compare/@%7B#{start_date}%7D...main@%7B#{end_date}%7D)._
_We had [#{contributors.total} contributors](#{contributors.url}) to the Rails codebase this past week!_
Until next time!
Until next time!
_[Subscribe](https://world.hey.com/this.week.in.rails) to get these updates mailed to you._
)

slug = "TODO"
post_path = "_posts/#{end_date}-this-week-in-rails-#{slug}.markdown"
post_path = "_posts/#{end_date}-this-week-in-rails.markdown"

File.open(post_path, 'w') do |f|
f.write meta
Expand Down
Binary file added assets/images/this-week-in-rails.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c85b302

Please sign in to comment.