Skip to content

fetchable_fields doc or implementation bug #325

@thomassnielsen

Description

@thomassnielsen

In readme.md there's a code sample for using fetchable fields:

class AuthorResource < JSONAPI::Resource
  attributes :name, :email
  model_name 'Person'
  has_many :posts

  def fetchable_fields
    if (context.current_user.guest)
      super(context) - [:email]
    else
      super(context)
    end
  end
end

When I tried to implement this, I got an error that super doesn't take any arguments. Removing (context) made the code work as expected. Is this a doc bug or a bug in the fetchable_fields implementation? I'm using JSONAPI::ActsAsResourceController, if that has anything to do with it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions