The method show in WordsController is doing too many things.
As a best practice keep controllers thin with limited logic. Think of controllers as simple coordinators which delegate all heavy lifting to models or other objects e.g. services, factories...
Tip: a controller method should not instantiate more than 1 or 2 variables (@). Use rubocop as it will help you to follow Ruby conventions.
I've fix this now, most of the "scraping" logic is at the model, where once the file is uploaded, the scraping also starts and stores in the same table.
The method
show
inWordsController
is doing too many things.As a best practice keep controllers thin with limited logic. Think of controllers as simple coordinators which delegate all heavy lifting to models or other objects e.g. services, factories...