I have a conroller, on which I'm using the send() method to find the
correct property to assign a posted value to. This looks like so:
@charactersheets.send(abl) = v
Where the abl variable is defined earlier, and is a method. And the v
variable is a post value assigned earlier. I used to use a switch-case
to assign the value, and that worked fine, but this should save time,
why does it not work? I get the following error:
because the result of a method call like that isn't an assignable value. It's like writing Math.sqrt(4)=3, you just can't do it.
Assuming the variable name is foo, what you need to do is call the foo= method, passing v as the argument.