I have a lot of data in JSON and want to import it to my db. My problem is, that I have several after_create and after_update methods in my controller, where other stuff is written to the db.
So I was thinking to use the controller for importing the data. I can format my data to be the same format as the params hash. But when I create an instance of the controller, setting the params hash and calling create it doesn't find some class variables.
Then I tried to force RSpecs controller test to do the work with a post, but I failed there too. Maybe it's not possible, or there is even a better option to import data using all the hooks in my controllers.
import to db of your json datais one time? or request level..