Interference Marketable Routes & ActiveStorage fixed#3385
Interference Marketable Routes & ActiveStorage fixed#3385Obi-TOB wants to merge 5 commits intorefinery:masterfrom
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.
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.
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.
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.
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