voltrb / volt

A Ruby web framework where your Ruby runs on both server and client
MIT License
3.22k stars 196 forks source link

Fix VoltTime comparison with nil issue #345

Open matthew342 opened 8 years ago

matthew342 commented 8 years ago

Setting a model attribute that contains a VoltTime to nil raises 'undefined method `getutc' for nil:NilClass' when volt/models/model.rb:213 tries to compare the new (nil) value to the old value.

Example stacktrace:

NoMethodError:
       undefined method `getutc' for nil:NilClass
     # /Users/Matt/.rvm/gems/ruby-2.3.0@volt/bundler/gems/volt-f942b92385ad/lib/volt/helpers/time/volt_time.rb:97:in `=='
     # /Users/Matt/.rvm/gems/ruby-2.3.0@volt/bundler/gems/volt-f942b92385ad/lib/volt/models/model.rb:213:in `!='
     # /Users/Matt/.rvm/gems/ruby-2.3.0@volt/bundler/gems/volt-f942b92385ad/lib/volt/models/model.rb:213:in `set'
     # /Users/Matt/.rvm/gems/ruby-2.3.0@volt/bundler/gems/volt-f942b92385ad/lib/volt/models/field_helpers.rb:90:in `block in field'