Skip to content

Conversation

@klondikemarlen
Copy link

The original code was always overriding the "pepper" value with table_name, so it didn't matter what you set that value to in the config.
The config's "pepper" value should be respected.

@klondikemarlen
Copy link
Author

I didn't quite think this through, I'll throw up proper solution (that doesn't fail all the tests) quite soon.

The original code was always overriding the "pepper" value with `table_name`, so it didn't matter what you set that value to in the config.
The config's "pepper" value should be respected.
@klondikemarlen
Copy link
Author

klondikemarlen commented Jul 10, 2022

The config now supports setting the pepper as a Proc and evaluating it on the class. Plus now all the tests pass! 😛.

This has the advantage that you can now both disable your pepper, and make your pepper much more complex.
i.e.

# Call a custom "pepper" method defined on the class
Hashid::Rails.configure do |config|
  config.pepper = ->(klass) { klass.pepper } 
end

# Disable pepper altogether.
Hashid::Rails.configure do |config|
  config.pepper = nil
end

@klondikemarlen klondikemarlen changed the title Avoid Clobbering the Configs Pepper Value Avoid Clobbering the Config's Pepper Value Jul 10, 2022
@klondikemarlen klondikemarlen closed this by deleting the head repository Mar 19, 2023
@cseelus
Copy link

cseelus commented Jun 23, 2023

Can this be merged? :-)

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