How to set a dynamic attribute How to set a dynamic attribute ruby-on-rails ruby-on-rails

How to set a dynamic attribute


I believe that you're looking for the following:

dest_table.send(:"#{col}=", xyz)


You can try

dest_table.write_attribute(col, xyz)

OR

dest_table[col] = xyz

OR

dest_table.send("#{col}=", xyz)