birthday
birthday copied to clipboard
Named fields
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.
Is this repo being maintained? If so I can refactor and rewrite for other adapters.
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?
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.
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?