FIX: detection of error changed, so you can clear errors

This commit is contained in:
Sam 2017-04-20 16:55:09 -04:00
parent 703e6faf54
commit 5365973c0a
2 changed files with 8 additions and 4 deletions

View File

@ -95,10 +95,12 @@ COMPILED
self.error = nil unless error.nil?
rescue SassC::SyntaxError => e
self.error = e.message
if error_changed?
update_columns(error: self.error)
end
end
if error_changed?
update_columns(error: self.error)
end
end
end

View File

@ -21,8 +21,10 @@ HTML
field = ThemeField.create!(theme_id: 1, target: 0, name: "scss", value: css)
field.reload
expect(field.error).not_to eq(nil)
field.value = ""
field.value = "body {color: blue};"
field.save!
field.reload
expect(field.error).to eq(nil)
end
end