Closed nathandonato closed 4 years ago
Good solution. But before I merge, I've runned the test and I checked there is some messages like 'Objetivo não criado' (that is) a failure message, can you take a look at this?
Sure, I will look into this today.
@eduqg I fixed the issue.
Partial https://github.com/eduqg/LifeToRemind/issues/3
This PR pulls the JSON import/model creation stuff out of
PlansController
and into a place calledPlansHashImporter
.Regressions were avoided by having the entry-point class
PlansHashImporter
accept the same hash structure that the controller originally did (many models in the same JSON object) and by allowing the controller to still use thecurrent_user
.It's important to note, though, that this PR also attempts to accommodate for future functionality. It adds individual importers for each of the models in question so instead of needing the full controller-like JSON object, you can seed each object independently. This opens up the possibility of having future rake tasks or
seeds.rb
reuse this same importer code.