Displaying 20 results from an estimated 2000 matches similar to: "Unknown Action doesn't raise exception ?"
2009 Feb 04
2
rendering error page for "Unauthorized" from before_filter
Hey all,
I am writing a plugin in which I want to stop the rendering of an
action with an unauthorized response if the user is not authorized to
view the resource. I am using a before filter to achieve this and
inside that before filter I do it like so:
render :text => "Unauthorized!", :status => :unauthorized, :layout
=> false
The status is properly set since I see the
2006 Feb 16
3
rescue_action_in_public question
I''m using the rescue_action_in_public example from the Agile book to
handle errors and email serious ones to me. In my application.rb
controller:
def rescue_action_in_public(exception)
logger.error("rescue_action_in_public executed")
case exception
when ActiveRecord::RecordNotFound, ActionController::RoutingError,
ActionController::UnknownAction
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 Feb 07
1
AWDWR: NameError (uninitialized constant UnknownAction) in rescue_action_in_public
I copied (and modified) this code from AWDWR:
def rescue_action_in_public(exception)
case exception
when ActiveRecord::RecordNotFound,
ActionController::UnknownAction
render :template=>''/error'', :layout=>''application'',
:status=>''404 Not Found''
else
render :template=>''/error'',
2007 Jan 20
1
Missing action error not being caught
I keep getting a blank page containing only the following:
"There was a controller specfic error processing your request."
Though I have the following in my application.rb
def rescue_action_in_public(exception)
case exception
when UnknownAction, ActiveRecord::RecordNotFound then
render :controller => "application", :action =>
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
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",
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 Feb 03
2
testing to see if emails are sent out on exceptions
Hi,
I''m using ActionController::rescue_action_in_public() to send emails
when uncaught exceptions happen.
Is it possible to write tests for that?
Joe
2010 Jul 26
2
Exception Pages when behind a proxy
I am not sure if this desired feature or not but when we are behind a
local proxy ie. Nginx/Varnish then the new ShowException middleware
doesn''t seem to properly detect the remote IP address and it appears
as if every browser gets a local error page with a stack trace, etc.
I''ve opened up a ticket on the rails bug tracker but I also would like
to verify that this is in fact a
2006 Nov 08
0
routing error does not get caught by rescue_action_in_public
I have this in my application controller.
def rescue_action_in_public(exception)
logger.error("rescue_action_in_public executed")
case exception
when ActiveRecord::RecordNotFound,
::ActionController::UnknownAction,
::ActionController::RoutingError
logger.warn("rendering 404 page")
render(:file =>
2005 Dec 18
2
Default routes for unknown actions
Hi folks-
I have the following map for default ''junk'' routes:
map.connect ''*anything'', :controller => ''welcome'', :action =>
''unknown''
Which works just fine for a URL like: "mysite.com/junkjunkjunk"
However, it still tries to resolve an action when I do:
"mysite.com/my_controller/junkjunkjunk"
2007 Jan 11
0
writing tests for rescue_action_in_public
I''m having trouble with rescue_action_in_public, both in getting it
to work right in my rails app, and in writing tests to make sure.
What I ultimately want to do is test for what a normal user would see
when an error is trapped.
I override local_request? like so:
application.rb
--------------
def rescue_action_in_public(exception)
render :text => "oops"
end
def
2006 Jul 04
0
ActionController::UnknownAction hangs application
I''m trying to override rescue_action_in_public() using the PP example,
but my application hangs every time I generate an error.
def rescue_action_in_public(exception)
case exception.class
when ActiveRecord::RecordNotFound,
ActionController::UnknownAction
render( :file => "#{RAILS_ROOT}/public/404.html",
:status => "404 Not
2007 Jun 26
3
what is the :or parameter in a submit_tag ?
I read the following tag in teh Beast example
<%= submit_tag''Login'', :or => link_to_function(''forgotten password'',
"$(''reset-password'').toggle();") %>
I understand the link_to_function, but what is this :or parameter used
for ?
the link doesn''t appear, so it cannot be used...
thanks for your lights
kad
--
2007 May 10
13
REST own action
I can sent my own action to a users_controller stating in routes.rb
map.resources :users, :member => { :network => get }
I defined in my users_controller the network action....
so I can have an url like
"http://localhost:3000/users/168.xml;network"
now I would like to have another action network_plus which is a little
bit different fron the network..
sure, I can state another
2006 Oct 14
2
sending parameters with link_to_remote Ajax Request
In a panel, I have an hidden input field which is modified by a
javascript function (from calendar)
how can I sent the value of this input field in my link_to_remote call ?
presently I just send back one parameter (an id) but I need both...
<input type="hidden" name="booking[start_at]" id="f_date_s"
value="booking[start_at]" />
...
<%=
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
2007 Jun 12
3
REST Routing issue
If I use http://0.0.0.0:3000/users/25/messages/new
I can create a new message ressource for user 25 that''s OK....
I would like to be able to use such url :
http://0.0.0.0:3000/users/25/messages;send?to=5
in order to create a new message from user 25 for a specific receiver
how should write my route ? I tried....
map.resources :users do |users|
users.resources :messages,
2006 Aug 09
5
Action Mailer ...mail done but not received.. (or sent ?)
I am using Action Mailer as stated in RoR book... the mail seems to be
correctly setup..
and I get the following log..
Sent mail:
Date: Wed, 9 Aug 2006 19:54:04 +0200
From: support@alemat.com
To: myself@mac.com
Subject: Your password is ...
Mime-Version: 1.0
Content-Type: text/html; charset=utf-8
_____________
Your username is barbare. Your new password is tDRvfzNvDF. Please login
and change