1. 19 Jan, 2015 2 commits
    • Fixes restoring polymorphic has_one relationships · 723ec506
      If the association object is a has_one relationship with an :as option,
      it will have a type attribute (see
      https://github.com/rails/docrails/blob/master/activerecord/lib/active_record/reflection.rb#L280).
      
      If this type attributes is present, that will be the type column on the
      polymorphic model. The foreign key can be found as an attribute on
      the association object.
      Patrick Koperwas committed
    • Create Failing Test · ed7793d4
      Restoring polymorphic has_one relationships errored because paranoia was
      not correctly looking up the foreign_key.
      
      Output from failing test -
      
      ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: parent_model_id: SELECT  "polymorphic_models".* FROM "polymorphic_models" WHERE ("polymorphic_models"."deleted_at" IS NOT NULL) AND (parent_model_id)  ORDER BY "polymorphic_models"."id" ASC LIMIT 1
      
      The test sets up a PolymorphicModel, which has_many parents. The
      ParentModel then has a has_one relationship with PolymorphicModel. When
      restoring, the foreign key is set as - `self.class.name.to_s.underscore_id`
      which will be parent_model_id, instead of the :as option.
      Patrick Koperwas committed
  2. 18 Jan, 2015 5 commits
  3. 09 Jan, 2015 1 commit
  4. 23 Dec, 2014 1 commit
  5. 17 Dec, 2014 2 commits
  6. 03 Dec, 2014 3 commits
  7. 28 Nov, 2014 3 commits
  8. 27 Nov, 2014 2 commits
  9. 26 Nov, 2014 4 commits
  10. 23 Nov, 2014 1 commit
  11. 21 Nov, 2014 1 commit
  12. 19 Nov, 2014 1 commit
  13. 13 Nov, 2014 1 commit
  14. 23 Sep, 2014 2 commits
  15. 19 Sep, 2014 1 commit
  16. 18 Sep, 2014 1 commit
  17. 16 Sep, 2014 2 commits
  18. 08 Sep, 2014 1 commit
  19. 04 Sep, 2014 2 commits
  20. 29 Aug, 2014 1 commit
  21. 28 Aug, 2014 3 commits