Displaying 20 results from an estimated 900 matches similar to: "rescue_from for NoMethodError"
2007 Dec 22
8
Rails 2.0 rescue_from
I am trying to use the new Rails 2.0 macro : rescue_from
class PostsController < ApplicationController
rescue_from ActiveRecord::RecordNotFound, :with => :deny_access
...
def show
@post = Post.find_by_id(params[:id])
raise ActiveRecord::RecordNotFound if @post.nil? #illegal access
.....
end
def deny_access
respond_to do |format|
format.html
end
end
but the
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
2008 Aug 01
1
rescue_from ActionController::MethodNotAllowed
Hello,
I''m having some trouble handing ActionController::MethodNotAllowed
errors. Basically, the following is defined in my controllers, but
obviously I''m missing something. Thanks in advance for any light you
can shed.
- - - - - - - - - - - - - - - - - - - -
class UsersController < ApplicationController
rescue_from ActionController::MethodNotAllowed, :with
=>
2008 Nov 17
2
Can't seem to test http error codes
in application.rb
rescue_from ActiveRecord::RecordNotFound { |e| http_status_code
(:missing, e) }
def http_status_code(status, exception)
@exception = exception
respond_to do |format|
format.html { render :template => "shared/status_#
{status.to_s}", :status => status }
format.any { head status }
end
end
in a controller
project =
2007 Oct 21
7
exact exceptions in rescue_from
rescue_from stores exception class names in a hash table, and
associates them with handlers.
When an exception is raised there''s a name lookup, and if an entry is
found its handler is invoked. In particular rescue_from does not
emulate Ruby''s rescue semantics with regard to inheritance.
Which is the rationale? Don''t you think taking is_a? and declaration
order
2008 Oct 24
1
rescue_from and assert_raise
Since commit 5e3517ea7b9fbd460f772bffc9212d882011f2bc, rescue_from is
now being handled in tests. I''ve been using rescue_from to handle
custom exceptions and testing that those exceptions are raised in
functional tests with assert_raise. This no longer works now. What''s
the proper way to test this now?
--~--~---------~--~----~------------~-------~--~----~
You received this
2010 Aug 08
2
issue with rescue_action_in_public! and testing 404 responses
Hello,
I''m new to rails and I''m trying to wrap my heads around how to spec
controllers using RSpec (using rails 3rc1 and rspec 2.0.0.beta.19).
The problem I''ve run into is when I want to test that my controllers respond
with a 404 for unfound records.
Whenever I run the spec, the ActiveRecord::RecordNotFound exception is not
caught by rails, causing the spec
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
2008 Aug 21
1
rescue_from failing to rescue [from]
Having some weird failures of rescue_from in all my specs. They still
rescue in actual usage, just not in my specs. Made a pastie of the code:
http://pastie.org/257399 This is with latest [as of 1:00 PM Eastern time
zone] rspec/rspec-rails/edge. Thanks in advance for any replies on this.
RSL
--
Posted via http://www.ruby-forum.com/.
2016 Jul 18
2
[PATCH] mllib: Getopt: fix integer parsing
Since we are using gnulib already, make use of xstrtol to parse the
integer arguments to avoid extra suffixes, etc.
Fixes commit 0f7bf8f714898c606e5d5015fff5b7803dcd1aee.
---
mllib/getopt-c.c | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/mllib/getopt-c.c b/mllib/getopt-c.c
index 1f129a7..2d3f9b6 100644
--- a/mllib/getopt-c.c
+++
2017 Oct 14
2
Bug in replaceUsesOfWith: does not keep addrspace consistent in GEP
Hello,
Calling `replaceUsesOfWith` with a value in a different addrspace does not
keep the addrspace of a GEP consistent. Is this known? Is this a bug or
expected behaviour?
Minimal counterexample link
<https://gist.github.com/bollu/152ba5e1c20c03c7fc6d8c7b23ba828f>
Reproduced here:
#include <iostream>
#include "llvm/ADT/APFloat.h"
#include
2009 Apr 03
0
Truncated development log when using rescue_from
I''m noticing that my development.log messages are not showing the usual
complete logging per request/response when I am catching exceptions from
my controllers using rescue_from. I was wondering if anyone has ever
encountered this issue before. I''m using Rails 2.2.2.
Processing DomainsController#show to xml (for 127.0.0.1 at 2009-04-03
16:41:38) [GET]
Parameters:
2009 Jan 16
5
Help: OpenId and restful_acl
Hi All,
I have restful_authentication with restful_acl installed on my
app, now I want to use OpenId with restful_acl,so my question is... does
this make any problems for me or not? I haven''t explored the OpenId for ROR
yet, and I am going to do that now,but I just wan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed
2008 Dec 31
7
Understand submit_tag
Hi everyone,
I was following the book Agile Web Development with Rails 2Ed. by Dave
Thomas.
So, at some part of my studies, I decided to try to create my own
application based on what I''ve learned...
Now I''m in trouble in a simple form.
I tried to create a form to register new users.
I''m sending attached the files that I created for this.
but my view don''t
2009 Jan 09
14
undefined local variable or method `current_user' for
Hi All, I am using a Plugin mdarby-restful_acl with
restful_authentication and I am following the procedure form
http://github.com/mdarby/restful_acl/tree/master , but I am getting some
irritating error "undefined local variable or method `current_user'' for", I
know I am missing something but I dont know what?
Can anybody help me regarding this?
Shahroon
2013 Nov 12
7
Hook into Exception Chain
Hi there,
I''m using Log4r in my rails projects. On log.error an email is sent using
the EmailOutputter.
I know changed the EmailOutputter to include a global var in the subject
(MDC) since the subject is normally static.
I want to set this var to the exception message, so it is sent as the
subject.
Can anyone tell me how to do this in rails?
Basically:
raise e or some other cause
2007 Feb 15
1
wrong startup information in production environment
Hi,
I check out the last codes from merb repository. And the startup
information for production environment just like that:
======================================================
dev:/var/www/apps/upload_merb/current/log# /etc/init.d/merb_init start
Merb started with these options:
---
:template_ext:
:html: :herb
:js: :jerb
:xml: :xerb
:config: dist/conf/upload.conf
:drb_server_port:
2009 Apr 12
1
handling ActiveRecord::RecordNotFound
How should we handle requests for invalid objects which do not exist in
database, ActiveRecord::RecordNotFound error ?
I am writing begin-rescue as follows:
def show
begin
@phone = Phone.find(params[:id])
rescue ActiveRecord::RecordNotFound
flash[:notice] = NONEXIST_OBJECT
redirect_to :controller => :phone, :action => :index
else
respond_to do |format|
2009 Mar 20
1
bypass_rescue and its inverse
Hey,
I''ve just started using rspec-rails 1.2 and the bypass rescue
declaration is wonderful - by default I tend to write controller which
raise exceptions (in exceptional circumstances), along with before-
filters as guard clauses, so being able to switch off rescue from
(which I properly spec separately) is a real boon.
Such a boon, in fact, that I immediately shoved it into a
2009 Sep 19
2
MethodNotAllowed
I am trying to develop an application that allows users to submit
articles and add information about the references they used when
citing facts. I have the sources broken down into types, such as
books, periodicals, web-sites, etc as single table inheritance on the
sources table. Routes are nested so that :articles, :has_many
=> :sources When trying to edit a source, through the