Skip to content

Commit 38a62a2

Browse files
committed
Simplify variant options in images helper and add money-rails upgrade docs
1 parent c597672 commit 38a62a2

File tree

2 files changed

+95
-1
lines changed

2 files changed

+95
-1
lines changed

app/helpers/pwb/images_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def opt_image_tag(photo, options = {})
101101

102102
# Build variant options if dimensions specified
103103
variant_options = {}
104-
variant_options[:resize_to_limit] = [width, height].compact if width || height
104+
variant_options[:resize_to_limit] = [width, height] if width || height
105105

106106
# Use picture element with WebP source for better performance
107107
if use_picture && photo.image.variable?

docs/money-rails-3-upgrade.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Money-Rails 3.0.0 Upgrade Prep
2+
3+
**Date:** January 22, 2026
4+
**Status:** Planned
5+
6+
---
7+
8+
## Summary
9+
10+
Prepare to upgrade `money-rails` from 2.0.0 to 3.0.0. The primary breaking change in 3.0.0 is dropping Rails < 7.0 support, which this app already satisfies.
11+
12+
---
13+
14+
## Requirements
15+
16+
- Ruby >= 3.1 (repo uses 3.4.7 via `.tool-versions`)
17+
- Rails >= 7.0 (repo uses ~> 8.1 in `Gemfile`)
18+
- Bundler 2.6.9 (required by `Gemfile.lock`)
19+
20+
---
21+
22+
## Preflight Checks
23+
24+
```bash
25+
rg -n "money-rails" Gemfile Gemfile.lock
26+
rg -n "Monetize\\.extract_cents|extract_cents" app lib spec
27+
```
28+
29+
Expected:
30+
- `Gemfile` uses `gem "money-rails", "~> 2.0"` before the upgrade.
31+
- No usage of `Monetize.extract_cents` (removed in Monetize 2.0).
32+
33+
---
34+
35+
## Upgrade Steps
36+
37+
1. Update `Gemfile`:
38+
39+
```ruby
40+
gem "money-rails", "~> 3.0"
41+
```
42+
43+
2. Update the lockfile:
44+
45+
```bash
46+
bundle update money-rails
47+
```
48+
49+
If bundler is missing:
50+
51+
```bash
52+
gem install bundler:2.6.9
53+
```
54+
55+
3. Verify the lockfile shows `money-rails (3.0.0)`.
56+
57+
---
58+
59+
## Touchpoints to Verify
60+
61+
- `config/initializers/money.rb` (MoneyRails configuration)
62+
- `app/models/concerns/*priceable*.rb` (monetize macros)
63+
- `app/helpers/currency_helper.rb` (Money formatting helpers)
64+
- Views that call `Money.new(...).format`
65+
66+
---
67+
68+
## Test Plan
69+
70+
Run focused tests first:
71+
72+
```bash
73+
bundle exec rspec spec/helpers/currency_helper_spec.rb
74+
bundle exec rspec spec/models/concerns/pwb/property/priceable_spec.rb
75+
bundle exec rspec spec/services/pwb/exchange_rate_service_spec.rb
76+
```
77+
78+
Optional: full suite
79+
80+
```bash
81+
bundle exec rspec
82+
```
83+
84+
---
85+
86+
## Known Breaking Changes
87+
88+
- money-rails 3.0.0 drops Rails < 7.0 support (already satisfied here).
89+
90+
---
91+
92+
## Rollback
93+
94+
Revert `Gemfile` and `Gemfile.lock` to the previous versions if issues arise.

0 commit comments

Comments
 (0)