How can i use strings as varibles in ruby and assign values to it for eg:
"@" + "Patient".downcase = Patient.all.last
Thanks!
If you mean instance variables, you can do this:
instance_variable_set('@' + 'Patient'.downcase, Patient.last)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With