Subject: | add/edit routes fail to add/edit records on submit when more than one database handle is present in config.yml |
Module: Dancer::Plugin::SimpleCRUD
Version: 0.30
Perl : 5.12.3
OS:Linux [snip] 2.6.18-128.1.1.el5 #1 SMP Mon Jan 26 13:58:24 EST 2009
x86_64 x86_64 x86_64 GNU/Linux
On visiting the '/add' route a form is displayed correctly. However,
when the record is submitted, there is an exception that states the app
does not know which dsn to use. This could be because I have more than
one database connection in my config.yml. I notice in the source code
for SimpleCRUD.pm the following:
<code>
# Get a database connection to verify that the table name is OK,
etc.
my $dbh = database($args{db_connection_name});
</code>
but elsewhere while using quick_(insert|update), $dbh is not used,
instead keyword database (from Database plugin) is used as follows:
<code>
database->quick_insert($table_name, \%params);
</code>
Just to experiment I replaced all occurences of database- with $dbh-
and I could get some success adding,viewing records. But there is
another problem - The links for 'Add a new <record_label>', etc point to
routes that use an incorrect prefix (I am guessing from history.back())
Thank you in advance