search for: controllerexcept

Displaying 5 results from an estimated 5 matches for "controllerexcept".

2007 Jul 31
2
controller exceptions
...a product which you would like to restrict to administrators: def edit raise AdminAccessReqired unless session[:user] and session[:user].admin? @product = Product.find(params[:id]) raise UnknownProduct if @product.nil? render end Where AdminAccessReqired and UnknownProduct are ControllerExceptions. The controller exception hierarchy would be rooted with the base class, Merb::ControllerException. The Merb dispatcher would rescue any exception which was a kind_of ControllerException. Derived from ControllerException would be an exception for each of the HTTP error codes. For example: m...
2008 Feb 07
2
Catching non-Merb::ControllerExceptions Exceptions
Is there an agreed upon method for handling exceptions thrown by something outside of Merb? For example, DataMapper now throws a DataMapper::ObjectNotFoundError when a record isn''t found in the db. I''d like to catch these exceptions and raise a C:E:NotFound exception instead, but without having to wrap a lot of code in begin/rescue/end blocks. Thanks, Mike Irwin
2012 Jan 05
4
mySQL: ERROR 1045: Access denied for user 'root'@'localhost' (using password: NO)
Hello, I am using InstantRails 2.0 on windows. When building an app,I get this error when hit the browser(Action ControllerException caught): Access denied for user ''root''@''localhost'' (using password: NO) ----------------------------------------------------------------------------------------------- The database.yml file is configured like this: # MySQL. Versions 4.1 and 5.0 are recommend...
2007 Dec 19
3
Trapping custom exceptions in merb 0.5.0
Hi, I have the following setup: class Fred < Application class InvalidKey < Merb::ControllerExceptions::Unauthorized; end def blee raise InvalidKey unless key end end I have added a view exception template in views/exceptions/invalid_key.html.erb but I am not seeing the exception page being rendered ?? The request seems to correctly go to the right exceptio...
2007 Nov 16
9
Challenge
The original: http://pastie.textmate.org/private/lqvrlyyvkv2kbugoxtiz6w Send your submissions to me by email or on #merb. I''ll blog it, and pick a winner. The winner does not mean it makes it into Merb, just means I personally like it best. But it might make it into Merb. # Scenario: # You have a simple application that lists all the monkeys at the zoo. # Every monkey has a