JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Not able to call any callbackmethod on resource file

Open
#1,202 0 comments 0 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

I am not able to call any callback method on resource file, following code is not working for me. I have tried for my resource file.

class PeopleResource < JSONAPI::Resource
  before_save do
    @model.user_id = context[:current_user].id if @model.new_record?
  end
end

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

The report provides only a PeopleResource snippet and no file path, failing test, or expected callback behavior. Start by reproducing the before_save example with JSONAPI::Resource, then trace the callback entry point; done means the callback behavior is verified and covered by a regression test or the issue is narrowed to a documented limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.