Displaying 20 results from an estimated 600 matches similar to: "testing to see if emails are sent out on exceptions"
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
2005 Jan 11
7
default error page
Help, please.
I need redirection to a custom error page, instead of
the default Rails messages (e.g. Unknown action).
I use WebRick, no Apache, and i think i can''t use
public/.htaccess (# General Apache options).
Thanks.
___________________________________
Nuovo Yahoo! Messenger: E'' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica
Scaricalo ora!
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 Mar 14
7
Application error (Rails)
After I attempted to add ActionMailer functionality, it gave the
"Application error (Rails)" and now, everything on my site works, except
for the part where the Actionmailer ''would have'' sent the email.
I took that out now, re-uploaded the file, and ran "killall -USR1
dispatch.fcgi" and still nothing. Everything else works, except that.
Any idea what
2007 Sep 08
1
Unknown Action doesn't raise exception ?
As I am in development environment, I wrote in my config/environment.rb
ActionController::Base.consider_all_requests_local = false
in my application.rb, I wrote
def rescue_action_in_public(exception)
case exception
when RoutingError, UnknownAction
render :file => "#{RAILS_ROOT}/public/404.html", :status =>
404
else
logger.error
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 Sep 02
1
custom error handling
Please forgive me if this is a stupid question. If it has been
answered already, please point me to the answer, as my searching has
been fruitless.
How can I programatically handle 404s and 500s when using Mongrel?
I''ve read about using a proxy server config (.htaccess for example) to
render an ErrorDocument rather than whatever comes from Rails, but I
need something different. I would
2006 May 04
6
second assert_tag failling in rails integration test
Hi all,
I''m fairly new to rails and ruby, but I''ve come across an interesting
glitch and I''m not sure whether I''ve just got something wrong with my
assumptions or if it really is an error in the underlying framework...
I''ve created a bare-bones set of tests to show you where the problem is.
What follows are the steps I went through to reproduce 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 Mar 02
2
url_for_file_column not returning correct path
I added this test towards the end of the included
file_column_helper_test.rb that shipped with the file_column plugin:
def test_url_for_file_column_different_root_path
Entry.file_column :image, :root_path => File.join(RAILS_ROOT,
"public/files")
e = Entry.new(:image => upload(f("skanthak.png")))
assert_match %r{/public/files/entry/image},
2005 Oct 06
5
webrick seen only on local machine
I am running the webrick server (/script/server) and I would like to be
able to view the application from any browser. However, I can only see
my application from a browser opened up on the localhost. When I use
any other browser it times out. I have already modified the following
line in the /script/server file (I''ve tried the numeric ip address also)
so that it is the real ip
2006 Feb 20
1
Using :except or :only on a before_filter block
Hi all,
How do you use :except or :only conditions on a filter block? I can''t
seem to work out the syntax!
I''m currently doing:
before_filter { |c| c.role_required ''admin'' }
Thanks a lot!
Tom
2006 Jul 18
13
RANDOM
I am pretty much new at this ROR game and had what I think to be a
simple question.
I have a set of Sponsors that I would like to be able to select one at
random and display in the my html. I have already set up the DB,
scaffolded, set index controller and all is working smoothly.
I know that I can display them all by doing
<% for sponsor in @sponsors %>
<%= sponsor.name %>
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
2007 Feb 04
10
Spec''ing ActionMailer
Good morning (Pacific Time). I have a controller action that, as a
side-effect, sends an email to an administrator. I want it to do
something like this:
specify "when someone successfully signs up, an email should be sent
to the administrator with the person''s contact page" do
post :signup, {...lots o'' params}
response should_be success
#
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
2008 Nov 05
2
Warning: Ambiguous first argument; make sure.
Hello,
I''m getting this warning:
Warning: Ambiguous first argument; make sure.
in my unit test:
assert_match /^[a-zA-Z0-9]+$/, user.username
Does anyone know why or how to change it so it disappears?
Thanks
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
2006 Apr 27
6
Functional Test Problem. Nubee, please help
ALl my controllers require the user to be logged in. SO they will be
redirected to my "login" controller.
How do i login first in a functional test? Im assuming i use the setup
method to login the controller.
This is the setup method for the Activities controller functional test:
def setup
@controller = ActivitiesController.new
@request =
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'',
2006 Feb 11
5
Strange messages in "congratulations" mode
Hi All..
First off, I thought I''d let you know that im UBER new at ruby, so what
im asking you may have a really simple answer...
Anyway, i just started using RoR and i''ve set it up on OSX, running
Apache2.
It all goes fine and dandy, I get the "Welcome aboard" page to say that
its all setup and running ok, but when I click on "About your
applications