A
A
Askhat Bikmetov2014-05-04 16:40:44
ruby
Askhat Bikmetov, 2014-05-04 16:40:44

Finding a document by value in an array - Mongoid/Sinatra

There is a document in Monge:

{
  "_id": ObjectId("53638084e1054e706f000001"),
  "name": "Vasya",
  "order": [
    "burger",
    "nuggets",
    "mtdew"
  ],
}

Now I want to find it:
get '/order/:order' do
  @clients = Client.where(order: [':order'])
  haml :index
end

But I don't find anything. Tell me the correct action please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arkady Butermanov, 2014-05-04
@askhat

get '/order/:order' do
  @clients = Client.where(order: params[:order])
  haml :index
end

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question