I have a Car model in my application. I added a color box. My migration is as follows:
class AddColorToCars < ActiveRecord::Migration
def change
add_column :cars, :color, :string
Car.all.each do |car|
car.color = "silver"
car.save
end
end
end
in my form I add:
= f.input :color
and in the car model I added confirmation:
validates :color, presence: true
When I try to change an existing car and change its color to zero, I have the following error:
ERROR: current transaction is aborted, commands ignored until end of transaction block
When I turn off my check, everything works fine. What's wrong?
source
share