On Sunday, June 17, 2012 9:38:21 AM UTC-7, cult hero wrote: > > > I think it's probably best to create a new plugin and exception class >> (which would subclass Sequel::Error). NoExistingObject sounds good, but it >> indicates a serious issue when updating or deleting, so I don't think it is >> appropriate to reuse for your purposes. Your find! method would just go in >> the plugin's ClassMethods, and would raise that error. >> > > Okay. > > So would the class just exist in the plugin then? It would end up > being: Sequel::Plugins::RailsExtensions::ModelNotFound. I would prefer > having the exception be Sequel::Model::NotFound but I wasn't sure if that's > in line with the plugin protocol and, moreover, I don't know how to do it > dynamically only when the plugin is loaded. I had hoped the > validation_helper plugin would have some insight, but the exception that it > raises is in Sequel already. >
It's best to namespace it in the plugin, yes, so I would recommend using Sequel::Plugins::RailsExtensions::ModelNotFound. You aren't required to, you can create it whereever you want, but since the error is specific to the plugin, it's best to keep it in the same namespace. If you look at the tree plugin, it has an example of a plugin specific exception class. > > >> >> Thanks! I'm using Forme in a couple of projects (one Rails, one >> Sinatra). I haven't had a lot of feedback regarding it, so it you have >> any, please let me know. >> > > Where is the best place to discuss that project? I made a helper for Rails > that works a bit more like the standard form_for where you can just throw > an object at it and it figures out the action and a few other things (the > Rails _method and the authenticity token are added automatically). > I haven't had enough interest expressed to open up a Google Group/IRC channel for it, so the best place for general discussion currently is via private message (IRC/email), or for specific issues, the GitHub issue tracker. Thanks, Jeremy -- 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/-/MOVuJujAreIJ. 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.
