-
-
Notifications
You must be signed in to change notification settings - Fork 592
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
Configurable Route Generation #735
Conversation
…ut :friendlyid will generate standard rails style routes when used with e.g. polymorphic_path or form_for etc
@parndt here you go! |
@@ -196,6 +196,7 @@ module Base | |||
def friendly_id(base = nil, options = {}, &block) | |||
yield friendly_id_config if block_given? | |||
friendly_id_config.dependent = options.delete :dependent | |||
# friendly_id_config.routes = (options.delete(:routes) || :friendly) |
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'm a little confused about this line of code and why it's commented out? 😄
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.
Good catch :-) I think I'd added it in there before I realized I could leverage the set. Commented it out to test the set and then didn't delete it before committing :-) I'll remove this in the next commit.
@sjaveed that was lightning ⚡ fast. Could we please have some tests to ensure that we don't regress this behaviour, and a note in the changelog file? |
@parndt heh thanks :-) I did say I was frustrated :-) Let me see how to test this sucker properly. |
… to ensure existing behavior doesn't change and all tests continue to pass
@parndt updated to fix an issue with the default value of routes and to add tests. Any specific format you'd like me to follow for the Changelog? |
For changelog just something simple that links to this PR like in https://github.com/norman/friendly_id/blob/master/Changelog.md#520-not-released-yet |
@parndt updated the change log as well. Do let me know if you need me to change anything else :-) |
Thanks, I merged it as 8531cdc 😄 |
Awesome! Thanks @parndt! |
Given a model:
it generates:
With this patch, given a model like:
it generates: