Skip to content
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

it should not persist blank strings, but it does #121

Merged
merged 2 commits into from
Apr 10, 2013

Conversation

lucasrenan
Copy link
Contributor

I found a bug when trying to create a slug with a blank field, mongoid-slug stores a blank string broking to_param method.
Check it out https:/lucasrenan/mongoid-slug/blob/master/spec/mongoid/slug_spec.rb#L28 (this test is still failing).

So, could you give any advice how should I fix this bug? I tried to include a condition for build_slug method. however, it wasn't a good idea.

Thanks.

digitalplaywright added a commit that referenced this pull request Apr 10, 2013
it should not persist blank strings, but it does
@digitalplaywright digitalplaywright merged commit c3253bb into mongoid:master Apr 10, 2013
@digitalplaywright
Copy link
Collaborator

It was not my intention to close this pull request. I just wanted to merge it with master.

To answer your question I think the appropriate place to fix this is build_slug

Since a user can define custom slug id strategies it can not be assumed that the slug is a string. Like e.g the strategy here:

Please let me know if you have any thoughts on how you think this issue is best fixed.

@lucasrenan
Copy link
Contributor Author

it's not crear for me this "slug id strategies". can you give me an example?
thanks.

@digitalplaywright
Copy link
Collaborator

Look at the "Custom Find Strategies" section in the README.md for an example:

@digitalplaywright
Copy link
Collaborator

This is now fixed on master. Thank you for reporting this issue.

@lucasrenan
Copy link
Contributor Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants