Cannot rescue error in Rails application

I am creating an application where a user logs into an Oracle Database and runs prepared queries. I would like to use ActiveRecord to help run the queries, but I am running into some issues.

When the user attempts to login, I test the connection by running

def test (username, password)
    :adapter => 'oracle_enhanced',
    :database => '//database:1521/test',
    :username => username,
    :password => password

However, if a user inputs incorrect login information, I get the following error:


ORA-01017: invalid username/password; logon denied

on the rails page. When I try to reload the login page, it keeps showing that error and does not show the actual login page. The only way to remove this error is to restart the entire rails application.

Is this because I attempted to establish connection to a different database but it fails and it doesn't know what to do? Is there any way I can prevent this from happening?


I also got this issue before. To test a db connection, you should not use ActiveRecord::Base because it effects on the entire app, but you should create an abstract class instead. Here is the code:

class DbConnectionTest < ActiveRecord::Base
  @abstract_class = true

Then you just simply use the custom class:


Need Your Help

Android Button Text on same line

android android-layout android-button

So I have a button on each row in my expandable list, and below is my XML layout file for the text view and button (which are supposed to be on the same line), but the text "Assign Badge" is too lo...

Emulate Keystrokes with Python in Linux

python selenium-webdriver

I am writing a script in Python using Selenium that auto fills out a web form (a helpdesk ticketing system)

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.