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

Popular posts from this blog

javascript - Can Piwik report referrer in real time? -

asp.net - Google Drive Access: At least one client secrets (Installed or Web) should be set -

excel vba add hyperlink to shape in group -