diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-26 05:19:28 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-26 05:19:28 +0200 |
| commit | a1ddc25da0d2aa79a4d9216ef7792f26233bd38e (patch) | |
| tree | 4d53e6ccb631e588c9e1d25c7a2dc5ef2ef44135 /app/models | |
| parent | fa0ccc43010297c0c10e3075095c0a9171989498 (diff) | |
Stage 5 fixes: RouteWithParams removal, Globalize fallbacks, search stub, to_s(:db) → to_fs(:db), LockedByAnotherUser autoload, test environment config
- Remove safe_path helper and content_path shim from link_helper.rb
- Update all safe_path call sites in views to use named route helpers directly
- Fix Globalize fallbacks via config.i18n.fallbacks in application.rb, remove i18n initializer
- Stub Node.search returning none (search disabled pending PostgreSQL upgrade)
- Replace to_s(:db) with to_fs(:db) in node.rb, nodes_helper.rb, link_helper.rb, admin view
- Move LockedByAnotherUser to app/models/locked_by_another_user.rb for Zeitwerk autoloading
- Fix config/environments/test.rb: config.assets removed, cache_classes → enable_reloading,
test_order removed, minitest pinned to ~> 5.25
- Fix config/environments/development.rb: cache_classes → enable_reloading
- Park search vector migration in doc/ pending PostgreSQL and plpgsql availability
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/locked_by_another_user.rb | 1 | ||||
| -rw-r--r-- | app/models/node.rb | 13 |
2 files changed, 9 insertions, 5 deletions
diff --git a/app/models/locked_by_another_user.rb b/app/models/locked_by_another_user.rb new file mode 100644 index 0000000..6f9e272 --- /dev/null +++ b/app/models/locked_by_another_user.rb | |||
| @@ -0,0 +1 @@ | |||
| class LockedByAnotherUser < StandardError; end | |||
diff --git a/app/models/node.rb b/app/models/node.rb index f7a70d0..41c3867 100644 --- a/app/models/node.rb +++ b/app/models/node.rb | |||
| @@ -73,7 +73,7 @@ class Node < ApplicationRecord | |||
| 73 | raise( | 73 | raise( |
| 74 | LockedByAnotherUser, | 74 | LockedByAnotherUser, |
| 75 | "Page is locked by another user who is working on it! " \ | 75 | "Page is locked by another user who is working on it! " \ |
| 76 | "Last modification: #{draft.updated_at.to_s(:db)}" | 76 | "Last modification: #{draft.updated_at.to_fs(:db)}" |
| 77 | ) | 77 | ) |
| 78 | else | 78 | else |
| 79 | lock_for! current_user | 79 | lock_for! current_user |
| @@ -211,6 +211,13 @@ class Node < ApplicationRecord | |||
| 211 | self.created_at < new_id_format_date ? unique_path : id | 211 | self.created_at < new_id_format_date ? unique_path : id |
| 212 | end | 212 | end |
| 213 | 213 | ||
| 214 | # TODO: restore full-text search once PostgreSQL is upgraded. | ||
| 215 | # The tsvector/plpgsql approach requires PostgreSQL 10+ with plpgsql available. | ||
| 216 | # For now, search is disabled to unblock the Rails 7.2 upgrade. | ||
| 217 | def self.search(term, _ = {}) | ||
| 218 | none | ||
| 219 | end | ||
| 220 | |||
| 214 | protected | 221 | protected |
| 215 | def lock_for! current_user | 222 | def lock_for! current_user |
| 216 | self.lock_owner = current_user | 223 | self.lock_owner = current_user |
| @@ -255,7 +262,3 @@ class Node < ApplicationRecord | |||
| 255 | end | 262 | end |
| 256 | end | 263 | end |
| 257 | end | 264 | end |
| 258 | |||
| 259 | class LockedByAnotherUser < StandardError; end | ||
| 260 | |||
| 261 | |||
