Today I needed some semi-trivial Sequel functionality that I've needed (and re-derived) multiple times in the past. It's something that I feel is likely a common need for users.
In chatting with Jeremy on IRC, he suggested that he might add a new Recipes (or other title?) page to the documentation. But we need more than just one or two recipes before adding such a page. So... What common patterns do you occasionally see in Sequel? Sort of a code FAQ. For example: 1) Get a model instance based on some unique criteria if it exists, or create a new one with that criteria if it doesn't exist. (Yes, there's a method for this<http://sequel.rubyforge.org/rdoc/classes/Sequel/Model/ClassMethods.html#method-i-find_or_create>; however, when the criteria involves a PK you get the "node_id is a restricted primary key" error and the recipe should show how to work around that.) 2) Find the top N model instances based on the sum of some value in another table<http://stackoverflow.com/questions/11582763/find-models-with-summed-statistics> . If we can gather a bunch of good recipes we can put up a new page that (like the Cheat Sheet) may become a really useful tool for new (and not so new) Sequel developers. :) -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/sequel-talk/-/MW-WOOrh99YJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
