I am new to Ruby and Rails, and I am making my first application. I basically parse HTML and send it as JSON to the client.
I now have two sources for HTML data, but I could have more in the future. Because of this, I thought it would be nice to remove the code responsible for parsing the HTML code from the controller and put it in the service level. I came up with this structure:
- attachment
- Controllers
- model
- services
- source1_service.rb
- source2_service.rb
MainController calls both services to get projects and tasks; each service parses its own HTML code.
This is a good decision? Is there any more RoR way to do this?
source
share