Skip to content

Prefix options not being set when using find_every from option #347

@ivan05almeida

Description

@ivan05almeida

Considering a Resource set with a prefix option, if used the method find(:all) with the option from the records are not being instantiated with the prefix options.

  class Group
    self.site = "http://somesite.com"
    self.prefix = "/account/:account_id/"
  end
  
  # Given no from option, works fine
  Group.find(:all, params: { account_id: 1 })
  # make a request to "http://somesite.com/account/1/groups.json"
  # every record is instantiated with { account_id: 1 } as prefix options

  # Given from option as a Symbol
  People.find(:all, from: :search, params: { account_id: 1 })
  # make a request to "http://somesite.com/account/1/groups/search.json"
  # prefix option is empty for all records

  # Given from option as a string
  People.find(:all, from: "/account/1/managers", params: { account_id: 1 })
  # make a request to "http://somesite.com/account/1/managers.json"
  # prefix option is empty for all records

With the prefix option not available, when trying to update or delete the record the path will be malformed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions