I have this method that it’s soul purpose is to toggle a field and then
redisplay a chech_box helper and a image signifying that the field has
been updated. My issue, however, is that this method is to toggle
several different field all via one method simply because the code to do
so was all the same code save for the name of the field. I pass a value
in which is the name of the field that I am manipulating, for example:
def method_1(attribute_name)
…
end
In that method I find a user based on an id and then I need to set an
attribute based on the value passed in, so I have:
@user.find_by_id(params[:id])
@user."#{attribute_name}"
However, that last bit of code doesn’t work. Is there a way to do what I
am trying to do, that is, use dot notion on an object to update a field
whose value is being passed into the method? Thanks in advance,
-S