voltrb / volt

A Ruby web framework where your Ruby runs on both server and client
MIT License
3.22k stars 196 forks source link

Feature Request: A `find(global_unique_id)` and `find_by(key: val, key2: val2)` methods #276

Open Qqwy opened 9 years ago

Qqwy commented 9 years ago

I think that it would be very helpful to be able to use

some_collection.find(my_object_id)

which would basically do the same thing as

some_collection.where(id: my_object_id).first

or is there a better way?

Similarly, a more broad find_by(hash_of_arguments) would also be helpful:

houses.first.rooms.find_by(type:"Bedroom", occupant: some_user)

Of course, it might be that this functionality (Or something that works in a way similar to what was outlined above) already exists, and that I just cannot find it in the Docs.