Skip to content

Fix #6404: Trim whitespace from custom link text before saving#6405

Merged
compwron merged 3 commits intorubyforgood:mainfrom
nizam12khan:feature/6404-trim-custom-link-whitespace
May 28, 2025
Merged

Fix #6404: Trim whitespace from custom link text before saving#6405
compwron merged 3 commits intorubyforgood:mainfrom
nizam12khan:feature/6404-trim-custom-link-whitespace

Conversation

@nizam12khan
Copy link
Copy Markdown
Contributor

Resolves #6404

  • Added a before_save callback in CustomOrgLink to trim whitespace from the text field before saving.
  • Added a migration to trim whitespace from existing CustomOrgLink records (please review if this is desired). Used up/down methods since this is a data migration and not reversible. Tested locally to confirm it works.

db_before
DB_after

@github-actions github-actions bot added the ruby Pull requests that update Ruby code label May 28, 2025
private

def trim_name
self.text = text.strip if text.present?
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like a spec to go with this change, as with all changes. Can you add a spec in a follow up PR? Thanks in advance! :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have raised a follow up PR with specs #6407 , Kindly review it! Thanks!

@compwron compwron merged commit 001efd6 into rubyforgood:main May 28, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ruby Pull requests that update Ruby code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trim whitespace before saving custom link name in database

2 participants