activeresource icon indicating copy to clipboard operation
activeresource copied to clipboard

Associations with nested resources raise "prefix_option is missing" exception

Open ktimothy opened this issue 2 years ago • 0 comments

class Base < ActiveResource::Base
  self.site = "https://xxx.atlassian.net/rest/servicedeskapi/"
end

class Request < Base
  has_many :comments
end

class Comment < Base
  self.prefix = "/request/:request_id"

  belongs_to :request
end

Trying to get request comments Request.find('XX-1').comments fails:

~/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/activeresource-6.0.0/lib/active_resource/base.rb:1090:in `block in check_prefix_options': request_id prefix_option is missing (ActiveResource::MissingPrefixParam)

ktimothy avatar Jun 13 '22 17:06 ktimothy