Is it possible to achieve something like this?
- Suppose
nameandplural_nameare fields of Animal's table. - Suppose
pluralise_animalis a helper function which takes a string and returns its plural literal. - I cannot loop over the animal records for technical reasons.
- This is just an example
Animal.update_all("plural_name = ?", pluralise_animal("I WANT THE ANIMAL NAME HERE, the `name` column's value"))
I want something similar to how you can use functions in MySQL while modifying column values. Is this out-of-scope or possible?
UPDATE animals SET plural_name = CONCAT(name, 's') -- just an example to explain what I mean by referencing a column. I'm aware of the problems in this example.
Thanks in advance