by matsemann · 8y ago · 0 comments
declaraoids.findWhereNameEqualsX(persons, {x: "Mats"});
It will generate the function on the fly. User.find_by_username "alice"It's a shame it doesn't have declaraoids.makeMeASandwich() on the roadmap though.
In fairness, some RPC web frameworks do this in a completely non-ironic non-joke way. CakePHP "findBy" comes to mind.[1]
[1] https://book.cakephp.org/2.0/en/models/retrieving-your-data....
https://docs.spring.io/spring-data/commons/docs/current/refe...
Wasn't it an ActiveRecord thing to begin with? Spring got a lot of its more recent awful features by trying to copy Rails.
But in Ruby it's based on method_missing not a proxy. I believe ruby got it's method_missing idea from Smalltalk. But there might be other precursors.