Displaying 20 results from an estimated 10000 matches similar to: "begin, rescue, end for the whole darn app"
2005 Dec 11
7
Catching Exceptions in ActionController
I''d like to be able to catch ActionController::MissingTemplate
exceptions from within ActionControlle, *but*, MissingTemplate isn''t
defined within my controllers!!!
How is that possible - after all, all controller subclass
ActionController, so how are exceptions it defines not there!?
More importantly, how can I do this?
--
Posted via http://www.ruby-forum.com/.
2009 Dec 25
18
rescue_from ActionController::RoutingError II
OK ... so I''m not supposed to use it but ...
Why doesn''t rescue_from ActionController::RoutingError work witht he
code from
http://www.rubyplus.org/episodes/20-Extended-RESTful-Authentication-Rails-2-App.html
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
# See ActionController::RequestForgeryProtection for details
2006 Apr 28
3
Handling errors - incorrect value entered in url...
I have many "edit" actions in my project. If the url is like
http://localhost/project/3/edit and someone enters
http://localhost/project/3333333/edit the edit action will fails because
it cannot find a project with id of 3333333.
To combat this I am adding to every action like edit:
rescue
redirect_to :action => ''index''
flash[''errors''] =
2006 Jan 10
4
Problem creating MockController
Hi there,
I''m trying to create a mock controller to test the use of UrlHelper in
ActionMailer. I''m trying this:
require
''d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller''
# Re-raise errors caught by the controller.
#class DiscussionsController; def rescue_action(e) raise e end; end
class MockController < ActionController::Base
def
2008 Apr 30
7
rescue_from issue with AWS - uninitialized constant
The new rescue_from in edge rails seems to conflict with
ActionWebService, which I need for various other purposes. When I
define, for example (with AWS gem installed):
<b>rescue_from ActionController::RoutingError, :with
=> :page_not_found</b>
I get the exception:
<b>uninitialized constant
ActionWebService::Dispatcher::ActionController::Base</b>
OK, so AWS
2007 May 23
8
Rails Rendering diagnostics.rhtml in Controller Spec
Forgive me if this isn''t the proper list. It''s specific to the rSpec
Rails plugin.
The problem is, some controller actions are rendering the
"diagnostics.rhtml" template when I''m expecting it to render something
else in a controller spec. I''m assuming this is the template that
displays the error message and a stack trace when an error is raised
in the
2007 Nov 13
7
rails story runner returning a nil response code
Has anyone noticed any problems with the Rails story runner returning
a response code of "0" when doing get/post/etc methods? I just
grabbed the latest rails/rspec and just started noticing this problem,
http://pastie.caboo.se/117497
Regular controller specs pass as expected.
--
Josh Knowles
phone: 509-979-1593
email: joshknowles at gmail.com
web: http://joshknowles.com
2006 Feb 08
2
NameError (uninitialized constant UnknownAction)
Hi, I''m having a strange problem that only seems to be happening on our
production server. I never get this error locally but get it quite
often on the server. The other odd thing is it doesn''t seem to be
resulting in any error pages on the site. Everything looks fine...
I wanted to add a rescue_action_in_public to email me when there are
errors. So I followed the
2006 Oct 12
2
Test should fail !
Hello, a very strange thing is happening : the test below pass but it
should fail
I had a syntax error which produced an exception in the browser and http
500 in the script/console (using app.get ''/'')
But with rake test:functionals it passes - How is it possible ? Of
course this file is really executed by the test suite, I can see it in
the screen output of rake
Which
2006 Mar 07
17
Handling Erros from AWDWR
I''m getting to the point now where I really need to start trapping the
errors.
So from my AWDWR book, I added the following directly from the book into
application.rb...
def rescue_action_in_public(exception)
case exception
when ActiveRecord::RecordNotFound, ActionController::UnknownAction
render(:file => "#{RAILS_ROOT}/public/404.html",
2008 Sep 02
4
Rescue rails errors
Hi all,
Sometime, I get the following error in my application:
ActionController::InvalidAuthenticityToken in
ManageController#site_servers
ActionController::InvalidAuthenticityToken
I tried to put the code in manage controller between begin ... rescue
... end but it didn''t catch the error.
So I tried in the application.rb controller, I put the forgery code
between begin ... rescue ...
2006 Feb 01
3
Testing components
I''m using template components to modularize an application I''m working
on and am really happy with the way it''s going. Unfortunately, all my
attempts at writing functional tests for them fail. Trying to duplicate
my normal controller tests I have:
require File.dirname(__FILE__) + ''/../test_helper''
require File.dirname(__FILE__) +
2009 Aug 14
9
Rescuing from REXML::ParseException
Hello,
When I call an action with some invalid XML or JSON data a parse
exception gets raised from within Rails/Ruby (REXML or
ActiveSupport::JSON). The problem that I''ve got is how to handle these
exceptions. In my application_controller.rb I have the following for
debugging purposes:
def rescue_action_in_public(exception)
respond_to do |request|
request.all { render :text =>
2006 Jun 30
1
Taking Control of Un-handled Exceptions
Greetings,
I''m trying to catch all un-handled exceptions. I''m having problems
handling the RoutingError and UnknownAction exceptions.
I''ve added the following to my application controller as a protected
method:
def rescue_action(exception)
render(:text => "error")
end
As far as I understand, this should catch all uncaught exceptions and
override
2007 May 20
9
How to test for exceptions
Hi folks,
I''m in the process of converting a Test::Unit functional test to RSpec, but I''ve run into a slight problem. I tried looking through the documentation but I still don''t know what I missed.
Thanks in advance,
Blake
describe VenuesController, "on update" do
before(:each) do
@venue = mock("venue")
2006 Apr 14
8
Error with Web Service tests after upgrading to Rails 1.1.2
Hello.
I hope this is the right place to describe my problem ?
After upgrading to Rails version 1.1.2 from rails version 1.0.0, Web
Service functional tests seem broken.
I upgraded rails (as the root user / administrator) with:
# gem update rails --include-dependencies
then I upgraded my application (as myself) with:
? rake rails:update
% rake rails:update:configs
After these steps,
2007 Apr 17
8
problem with rspec_on_rails and @controller.should_receive(:render) in trunk
Hey guys!
I am using rspec trunk, and I am having a little problem with the
latest version. (I am quite sure this worked with an older version
about a week ago)
heres the spec:
it "should render the new user form without layout for a xhr request" do
@controller.should_receive(:render).with(:layout=>false)
xhr :get,:new
end
and the controller:
def new
render
2009 May 26
9
cookies are mandatory for Rails app?
is it true that Rails depend on cookies? It seems that flash is a part
of session, and session uses cookies... so when i disable cookie in
Firefox, what was working became
ActionController::InvalidAuthenticityToken
so is it true that for a RoR app to work, cookies are mandatory?
--
Posted via http://www.ruby-forum.com/.
2011 Mar 22
3
Premature end of script headers
after moving my app to production, I am getting the following error in the
apache error log. I am running on linode with apache and passenger.
any help would be great,
thanks,
Jason
[Tue Mar 22 00:18:04 2011] [error] [client 50.9.211.207] Premature end of
script headers:
[ pid=23638 thr=3063581552 file=ext/apache2/Hooks.cpp:821 time=2011-03-22
00:18:04.735 ]: The backend application (process
2005 Dec 21
2
Missing error page templates
Whenever I get any errors on my application, I don''t get the regular
rails error page with all the debugging information. What could''ve
cause this? This is from the logs:
ActionView::ActionViewError (No rhtml, rxml, rjs or delegate template
found for /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/templates/rescues/template_error.rhtml):