Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added association_proc #38

wants to merge 1 commit into


None yet
3 participants

fabiokr commented Mar 28, 2012

Allows one to set an association_proc to process an association value, like the already existing label_proc:

config.association_proc = lambda { |association, t| "#{association.id} - #{t}" }

carlosantoniodasilva commented Mar 28, 2012

Hey @fabiokr, thanks for your pull request. The implementation is fine, I'm just wondering what's your use case for this option. Thanks again.


fabiokr commented Mar 28, 2012

We wanted to add links to associations automatically:

config.association_proc = lambda { |association, t| link_to(t, association) }

carlosantoniodasilva commented Mar 31, 2012

Got it. But what happens if you end up using an association that does not map automatically to a url route using polymorphic url? You'd get an exception, that'd be hard to track down. And you can't skip the association proc, so no way to fix unless doing manual work. Still unsure that's a good thing.


nashby commented Oct 16, 2012

@carlosantoniodasilva we can add wrap_association to skip thus proc. Right now we have such option for label_proc.


carlosantoniodasilva commented Oct 17, 2012

@nashby what!?!? Seriously that we have that? 👅 I hope that it was not something I have accepted hahaha.

Well, I still think it's not worth having such option, there's no system that's so automatic like that to apply a link to every single association object. In any case, if we have a way to add it as default and opt-out in a per-call basis, I think it's fine either way, as long as the default is to not have a proc.


nashby commented Oct 17, 2012

@carlosantoniodasilva it's ok, it wasn't you :wink2: So maybe close it then?


carlosantoniodasilva commented Oct 18, 2012

I think so.. if this happens to be asked more and more we may review it again in the future. @fabiokr @nashby thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment