Use the gem without ActiveRecord
sosolidkk opened this issue · 2 comments
Hello! I have an application in which we're trying to create a public API and we wanted to use the JSON API specification to maintain the pattern inside the company. Unfortunately, the application we're trying to install and use this Gem does not have ActiveRecord because it doesn't need to. It accesses the models using MongoDB through the Mongoid gem.
Is there any way to overcome this issue? I've been thinking about putting in the repo a simple ActiveRecord configuration file with only a physical or in-memory database so I can establish a connection and move forward. I've also tried to disable ActiveRecord from trying to connect to a database and skip to the loading part but it doesn't seem to work. Can you think or another possible workaround to this issue? Thank you!
Here's a similar issue #55
Steps to Reproduce the Problem
- Create a Ruby application without ActiveRecord
- Install the
jsonapi.rb
gem - Run the application
It should return the following error:
15:28:52 web.1 | => Booting Thin
15:28:52 web.1 | => Rails 6.0.6.1 application starting in development http://0.0.0.0:3001
15:28:52 web.1 | => Run `rails server --help` for more startup options
15:28:52 web.1 | AssetSync: using /app/config/initializers/asset_sync.rb
15:28:52 web.1 | Exiting
15:28:53 web.1 | /usr/local/bundle/gems/activerecord-6.0.6.1/lib/active_record/connection_handling.rb:217:in `connection_pool': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
15:28:53 web.1 | from /usr/local/bundle/gems/activerecord-6.0.6.1/lib/active_record/connection_handling.rb:213:in `connection_config'
Specifications
- Version: 2.01
- Ruby version: 3.0.6
- Rails version: 6.0.6.1
@sosolidkk A fix can be found here #102. I'm not really sure about the process of getting the PR up to the repo standards, but I would love to learn if changes are required to it.