Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bin/from_devto
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SaveArticleToMarkdown
end

def save_to_md_file(data)
File.open("../content/pages/blog/#{slug(data)}.md", 'w') { |file| file.write(data['body_markdown']) }
File.open("../content/blog/#{slug(data)}.md", 'w') { |file| file.write(data['body_markdown']) }
puts "File #{slug(data)}.md successfully created."
end

Expand All @@ -55,9 +55,9 @@ class SaveArticleToMarkdown
end

def fill_seo_attributes(data)
markdown = File.read("../content/pages/blog/#{slug(data)}.md")
markdown = File.read("../content/blog/#{slug(data)}.md")

File.open("../content/pages/blog/#{slug(data)}.md", 'w') do |file|
File.open("../content/blog/#{slug(data)}.md", 'w') do |file|
file.write("+++\n")
file.write("title = \"#{data['title']}\"\n")
file.write("description = \"#{data['description']}\"\n")
Expand Down
73 changes: 0 additions & 73 deletions content/align-remote-teams-with-okrs-and-impact-mapping.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ So, why not give it a try and witness the positive impact on your startup's grow

**Paul Keen** is an Open Source Contributor and a Chief Technology Officer at [Showcase](https://showca.se) and [JetThoughts](https://www.jetthoughts.com). Follow him on [LinkedIn](https://www.linkedin.com/in/paul-keen/) or [GitHub](https://github.com/pftg).

If you enjoyed this story, we recommend reading our [latest tech stories](https://jtway.co/latest) and [trending tech stories](https://jtway.co/trending).
If you enjoyed this story, we recommend reading our [latest tech stories](https://jtway.co/latest) and [trending tech stories](https://jtway.co/trending).
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ These features provide more flexibility and readability when working with blocks

**Paul Keen** is an Open Source Contributor and a Chief Technology Officer at [Showcase](https://showca.se) and [JetThoughts](https://www.jetthoughts.com). Follow him on [LinkedIn](https://www.linkedin.com/in/paul-keen/) or [GitHub](https://github.com/pftg).

If you enjoyed this story, we recommend reading our [latest tech stories](https://jtway.co/latest) and [trending tech stories](https://jtway.co/trending).
If you enjoyed this story, we recommend reading our [latest tech stories](https://jtway.co/latest) and [trending tech stories](https://jtway.co/trending).
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ tags = ["ruby", "programming", "devops", "tutorial"]
+++
Let's integrate Homebrew into our Ruby on Rails Project local set up.

There is a convention for Ruby on Rails projects to use `bin/setup` to set up and install/update required dependencies. But by default, it does not include system dependencies.
There is a convention for Ruby on Rails projects to use `bin/setup` to set up and install/update required dependencies. But by default, it does not include system dependencies.

We are going to use [the Homebrew Bundle tool](https://github.com/Homebrew/homebrew-bundle) for this.

First, we need to have a `Brewfile` with:
First, we need to have a `Brewfile` with:

```ruby
# Redis - For ActionCable support (and Sidekiq, caching, etc.)
brew "redis"

# PostgreSQL - brew install postgresql
brew "postgresql"

# Overmind (requires tmux)
brew "tmux"
brew "overmind"

# Imagemagick or libvips - for processing images (avatars, file uploads, etc.)
brew "vips"

# Yarn - for installing Javascript dependencies
brew "yarn"
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ Review.in_order_of(
```
Which translates to SQL query like:
```sql
SELECT "reviews".* FROM "reviews"
WHERE "reviews"."status" IN (2, 0, 1)
SELECT "reviews".* FROM "reviews"
WHERE "reviews"."status" IN (2, 0, 1)
ORDER BY CASE "reviews"."status"
WHEN 2 THEN 1
WHEN 0 THEN 2
WHEN 1 THEN 3
WHEN 2 THEN 1
WHEN 0 THEN 2
WHEN 1 THEN 3
END ASC
```
This works well, as long as we don't have/care about reviews with `NULL` as their status.
Expand All @@ -55,8 +55,8 @@ Review.in_order_of(
```
Following SQL would be created:
```sql
SELECT "reviews".* FROM "reviews"
WHERE "reviews"."status" IN (NULL, 2, 0, 1)
SELECT "reviews".* FROM "reviews"
WHERE "reviews"."status" IN (NULL, 2, 0, 1)
ORDER BY CASE "reviews"."status"
WHEN NULL THEN 1
WHEN 2 THEN 2
Expand All @@ -69,16 +69,16 @@ But since `NULL` in SQL is a special value and `NULL != NULL`, then this query s
**The improvement**
Ruby on Rails 7.0.7 further improves the method: now it correctly handles the `NULL` values, so the resulting query would be:
```sql
SELECT "reviews".* FROM "reviews"
SELECT "reviews".* FROM "reviews"
WHERE (
"reviews"."status" IN (2, 0, 1)
OR "reviews"."status" IS NULL
)
ORDER BY CASE
ORDER BY CASE
WHEN "reviews"."status" IS NULL THEN 1
WHEN "reviews"."status" = 2 THEN 2
WHEN "reviews"."status" = 0 THEN 3
WHEN "reviews"."status" = 1 THEN 4
END ASC
```
Now it does exactly what we need without writing any custom SQL queries.
Now it does exactly what we need without writing any custom SQL queries.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ created_at = "2022-10-06T09:10:00Z"
edited_at = "2024-05-06T11:13:01Z"
sync_date = "2024-05-06T12:37:00Z"
draft = false
type = 'blog'
tags = ["rails", "ruby", "webdev", "programming"]
+++

Expand Down
Loading