mercredi 19 août 2015

Grabbing returned variables?

Lets say I have a model called Lead and a controller method called functions. Lead model has a method called grab.

def functions
    Lead.grab(data)
    puts newdata
end

def grab(data)
    newdata = data + 20
    return newdata
end

Why would this not work? The newdata variable is passed back but the functions method cannot seem to use it without an undefined error.

Aucun commentaire:

Enregistrer un commentaire