birthday icon indicating copy to clipboard operation
birthday copied to clipboard

Named fields

Open nextgenappsllc opened this issue 8 years ago • 4 comments

I needed to have a name for methods different for the field name used in queries. In my example I needed anniversary to be from the field named "hire_date" which I later refactored for rehires to "last_hire" and "orig_hire". Now you can pass named parameters with the key being the name used in methods and the value being what you want inserted in the query as follows:

acts_as_birthday(:birthday, anniversary: '(coalesce(last_hire, orig_hire))')

I did take out the back tics around the field name in the mysql adapter where query which is the adapter I am currently using. I have not rewritten for the other adapters.

nextgenappsllc avatar Dec 13 '16 20:12 nextgenappsllc

Is this repo being maintained? If so I can refactor and rewrite for other adapters.

nextgenappsllc avatar Mar 03 '17 06:03 nextgenappsllc

Hey @nextgenappsllc I am so sorry that nobody got back to you!! thanks a lot for the pull request!! @Holek and I are currently not actively working and thus sadly this gem is lacking some maintenance. sorry :(

@Holek could you help looking at this PR? I think it is an interesting change, but have to look closer. I am happy to merge and release a new version if this is fully backwards compatible.

Also @nextgenappsllc I think we should add some tests if possible?

bumi avatar Mar 15 '17 09:03 bumi

Thanks for the response @bumi !

This gem has worked great for my enterprise projects, its a shame more people aren't interested in it. I've been pretty busy but can write some tests this weekend. It might be worth it to upgrade the minimum ruby version to 2.0 as well. Thanks again and I'll get back to you after I make the changes.

nextgenappsllc avatar Mar 20 '17 20:03 nextgenappsllc

yes, @Holek did some great work here. also happy to hear it is helpful for you! Would be great if you could add some specs, then I will update the ruby version, do some maintenance and release a new version. Do you see any other things that should be changed quickly?

bumi avatar Mar 22 '17 03:03 bumi