ruby - Grabbing returned variables? -
lets have model called lead , controller method called functions. lead model has method called grab.
def functions lead.grab(data) puts newdata end def grab(data) newdata = data + 20 return newdata end why not work? newdata variable passed functions method cannot seem use without undefined error.
you should have newdata = lead.grab(data). variable newdata in grab function out of scope of controller, can't use it. have set variable in controller returned value of lead.grab(data).
Comments
Post a Comment