JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Broken support of ActiveModel resources in 0.10.x

Open
#1,306 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.3k
Forks
546
PR merge metrics
No merged PRs in 30d

Description

Based on gem documentation it is possible to create some service for ActiveModel resource. In fact, it does not work anymore in 0.10.x

The gem documentation has to be updated on wiki https://github.com/cerebris/jsonapi-resources/wiki/Using-JSONAPI::Resources-with-non-ActiveRecord-models-and-service-objects

There is some code examples in tests, but they are very complicated for such simple task.

https://github.com/cerebris/jsonapi-resources/blob/master/test/fixtures/active_record.rb#L1545

Please provide a real working example. It is a pain in ass to hack the gem to provide simple API for non ActiveRecord resource. I have very simple use case: returning list of all timezones via API:

ActiveSupport::TimeZone.all.map { |z| [z.name, z.to_s] }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the linked wiki page and the ActiveModel-related examples around test/fixtures/active_record.rb:1545. Verify which non-ActiveRecord resource setup works in 0.10.x, then update the wiki with a simpler working example for a service object or ActiveModel resource, including the timezone-list use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.