README.markdown in ismasan-sluggable_finder-2.0.2 vs README.markdown in ismasan-sluggable_finder-2.0.3
- old
+ new
@@ -61,9 +61,21 @@
def show
@post = Post.find( params[:id] ) #raises ActiveRecord::RecordNotFound if not found
end
end
+### Merb and custom NotFound exception
+
+In merb it would be nice to raise a NotFound exception instead of ActiveRecord's RecordNotFoundm so we don't need to clutter our controller with exception-handling code and we let the framework handle them.
+
+ SluggableFinder.not_found_exception = Merb::ControllerExceptions::NotFound
+
+You can configure this to raise any exception you want.
+
+ class CustomException < StandardError; end
+
+ SluggableFinder.not_found_exception = CustomException
+
### Links
Link generation remains the same, because the plugin overwrites your model's to_param method
<%= link_to h(@post.title), @post %> # => <a href="/posts/hello-world">Hello world</a>
\ No newline at end of file