Curious as to why friendly_id encourage 2 dashes, instead of one?
Am interested why this is the default logic. Any reason why they chose two dashes, instead of one?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I thought about this recently and tried to change the sequence separator to 1 dash and FriendlyId complained, apparently for a valid reason.
This link doesn’t answer your question exactly:
https://github.com/norman/friendly_id/blob/master/lib/friendly_id/slugged.rb#L87-92
However, there’s a tiny bit more info here:
https://github.com/norman/friendly_id/blob/master/lib/friendly_id/slugged.rb#L293-305
I also saw that when I was using the history module, and performing a create, it checks for more recent slugs by appending a the sequence separator to the end.
eg:
returned the following sql queries
If you changed the sequence separator to 1 dash, it would match items with slugs like ‘foo-bar’ and ‘foo-moo’ etc …
Hope this helps satisfy your curiosity 😀