I have a Rails 3.2 app where I would like to copy the contents of one field to another in a controller action.
Costprojects
contains these 2 columns:
original_year
project_year
I want to copy the contents of project_year
into original_year
.
I tried doing this:
update = Costproject.where(:id => @costprojects).update_all(:original_year => :project_year)
I get this error:
PG::Error: ERROR: invalid input syntax for integer: "project_year"
LINE 1: UPDATE "costprojects" SET "original_year" = 'project_year' W...
^
Thanks for the help!