-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interference Marketable Routes & ActiveStorage fixed #3385
Interference Marketable Routes & ActiveStorage fixed #3385
Conversation
Thank you very much @Obi-TOB ! Should we also add We don't want to create a page with this slug and not able to reach it. |
Hi @bricesanchez, I added all words from all reserved_paths to the friendly_id_reserved_words. I guess this might go a bit far... as this probably means no friendly_id slugs with rails or active storage. I'm not entirely sure how friendly id stores the slugs, but I think we need to exclude each word on it's own. Let me know what you think... |
self.friendly_id_reserved_words = %w( | ||
index new session login logout users refinery admin images | ||
) | ||
) + self.reserved_paths.map { |path| path.split('/') }.flatten.uniq - [""] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably just need to add rails
because we already just add refinery
or admin
in friendly_id_reserved_words
even if there are sub path to these paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now add only the first elements from each element of reserved_paths to friendly_id_reserved_words, so in the case we have only one element '/rails/active_storage' it will only take 'rails'. If you add several paths it will remove all 'root'-fragments of the paths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could use:
self.friendly_id_reserved_words = %w(
index new session login logout users refinery admin images
) | reserved_paths.map { |path| path.split('/') }.flatten.uniq.reject(&:blank?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to
self.friendly_id_reserved_words = %w(
index new session login logout users refinery admin images
) | self.reserved_paths.map { |path| path.split('/').reject(&:blank?).first}.flatten.uniq
to take only the all root_fragments of the reserved paths.
…ly the first, in case of ['/rails/active_record'] this only takes 'rails'
Thanks @Obi-TOB ! I've just seen that the new config Could you add it ? |
Closed in favor of #3387. |
Closes #3383