8000 Add `truncate` option. by nasa42 · Pull Request #27 · holli/auto_strip_attributes · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add truncate option. #27

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

Closed
wants to merge 1 commit into from
Closed

Conversation

nasa42
Copy link
Contributor
@nasa42 nasa42 commented Mar 5, 2018

We often need to truncate attributes to satisfy database column length constraints.
I think a simple truncate option would be a nice addition to auto_strip_attributes gem.

@nasa42
Copy link
Contributor Author
nasa42 commented Mar 8, 2018

@holli any updates on this?

@holli
Copy link
Owner
holli commented Mar 24, 2018

Sorry I've been busy doing paid stuff lately.

I don't necessary like the idea of truncate option. I've tried to keep the gem quite small and only add default options which don't destroy information. Truncate is good in some cases if you make a conscious choice. But in most cases its the wrong way to go and instead the model should have validator validates :subject, length: { maximum: 255 } to avoid unnoticeable change of data or bug.

I collected some of possible extra filters to wiki https://github.com/holli/auto_strip_attributes/wiki . I think thats the right place for those kind of filters that need a bit more thought before using them.

Then again the way you used options in this pull request seemed good idea. That might be worth merging so that the custom recipes could use them if needed.

@holli
Copy link
Owner
holli commented Mar 25, 2018

New version released so you can use custom options.

@holli holli closed this Mar 25, 2018
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
0