alright here is how far I got. Most of the script is in the controller. An issue I am also having is that I am not sure is my model reflects the fact that advertisement is a foreign key in attorney_spend. Overall script expects a string.