copasetickid / draftsman

Ruby gem that lets you create draft versions of your database records.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception when destroying drafts

npafundi opened this issue · comments

Looks like a small problem with checking for the JSON data type in PostgreSQL; causes draft_destroy to fail.

NoMethodError - undefined method `type' for nil:NilClass:
  <path>/draftsman/lib/draftsman/draft.rb:37:in `previous_changes_col_is_json?'
  <path>/draftsman/lib/draftsman/model.rb:243:in `block (2 levels) in draft_destroy'
  activerecord (4.2.0) lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
  activerecord (4.2.0) lib/active_record/transactions.rb:220:in `transaction'
  activerecord (4.2.0) lib/active_record/transactions.rb:277:in `transaction'
  <path>/draftsman/lib/draftsman/model.rb:231:in `block in draft_destroy'
  ...

I'll submit a pull request shortly that fixes this.