vendredi 30 octobre 2015

Sending variables to embedded Ruby/ Ruby on Rails

Lets say I wanted to make a function to return someone's age from a rails database.

function getName(name_input) {
return <%= Names.find_by(name: name_input).age %>
}

When I've tried similary functions is seems that rails doesn't have access to local variables. Is there a workaround?

Aucun commentaire:

Enregistrer un commentaire