Name |
Last commit
|
Last Update |
---|---|---|
lib | ||
test | ||
.gitignore | ||
.travis.yml | ||
CHANGELOG.md | ||
Gemfile | ||
LICENSE | ||
README.md | ||
Rakefile | ||
paranoia.gemspec |
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.
Name |
Last commit
|
Last Update |
---|---|---|
lib | Loading commit data... | |
test | Loading commit data... | |
.gitignore | Loading commit data... | |
.travis.yml | Loading commit data... | |
CHANGELOG.md | Loading commit data... | |
Gemfile | Loading commit data... | |
LICENSE | Loading commit data... | |
README.md | Loading commit data... | |
Rakefile | Loading commit data... | |
paranoia.gemspec | Loading commit data... |