i have some logic to code in my model to calculate the number of business days between 2 dates input by the user.
In my view i would like to display the same number of business days before the user submits the action…
Is there a way to do this without duplicating code?
I’d rather avoid an AJAX request (as it seems a bit overkill for that).
for your help
p.
I don’t think it’s worth not duplicating the code here- you are implementing it in two different languages. I do something similar in a .Net client that uses the webservice of my Rails app. Of course, I haven’t seen your business days code…
Second, it’s ridiculously easy to do AJAX in Rails, so I don’t consider that overkill.