Skip to content

Where with the primary key results in a find #93

@johan-smits

Description

@johan-smits

When you do a where query with the primary key in it uses does a find.

It should be possible to do for example: Recipe.where(id: [1,2], title: 'foo') but now it results in: http://sushi.com/recipes/1,2?title=foo and it should be: http://sushi.com/recipes?id[]=1&id[]=2&title=foo

#test/orm_test.rb
def test_where
  endpoint = stub_request(:get, 'http://sushi.com/recipes?id=1').to_return_json(result: [{ id: 1, title: 'Sushi' }])

  recipe = Recipe.where(id: 1).first

  assert recipe

  assert_equal 1, recipe.id
  assert_equal 'Sushi', recipe.title
  assert_requested endpoint
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions