Skip to content

Cannot set "hidden" attributes at the record creation #356

Closed
@xdmx

Description

@xdmx

I have the following resouce:

class CommentResource < Api::V2::BaseResource
  attributes :body

  def self.creatable_fields(context)
    [:privacy, :body]
  end
end

The Comment table has a privacy column which I allow in the creatable_fields, but I don't return in the response. When I try to create a Comment I get no implicit conversion of nil into Hash as response. It seems that I cannot set attributes if they're not set in the attributes array, but I don't want some of them being returned, so it should be accepted since it's present in the creatable_fields array.

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