# Help with Rails console to edit text template

**URL:** <https://meta.discourse.org/t/help-with-rails-console-to-edit-text-template/308691>\
**Category:** Self-hosting\
**Tags:** rails-console\
**Created:** [May 20, 2024, 12:52pm UTC](https://meta.discourse.org/t/help-with-rails-console-to-edit-text-template/308691 "2024-05-20T12:52:10Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![nordize](https://avatars.discourse-cdn.com/v4/letter/n/c68b51/32.png) [@nordize](https://meta.discourse.org/u/nordize)\
**Post date:** [May 20, 2024, 2:24pm UTC](https://meta.discourse.org/t/help-with-rails-console-to-edit-text-template/308691/7 "2024-05-20T14:24:34Z")

</div>

> [@nordize](#):
>
> TranslationOverride might be enough of a pointer

It was enough of a pointer, and I also found the bug (which is in the ruby code):

```ruby
to=TranslationOverride.where(translation_key:"user_notifications.user_watching_category_or_tag.text_body_template").first
to.value="%{username} posted in \"[%{topic_title}](%{base_url}%{url})\"\n\n--"
to.save!
ActiveRecord::RecordInvalid: Validation failed: The following interpolation key is invalid: base_url
from /var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8/lib/active_record/validations.rb:80:in `raise_validation_error'

```

`validations.rb` is the culprit … base\_url is valid, and does get parsed just fine (as I explained in the linked thread). It seems I either need to hack validations.rb (ugh!) or edit the SQL database directly (which is what I had after the upgrade) … so now I need to find where in the postgre database these template tags live ☹

p.s. It’s such an easy and quick fix though for the devs (I could do a PR but I only know a subset of tags where `%{base_url}` is missing from the valid tags)

---

_[View the full topic](https://meta.discourse.org/t/help-with-rails-console-to-edit-text-template/308691)._
