Daniel,

Thank you for your reply.  That certainly worked. So I'll need to call simple_crud every time to define a route to a table/page? I might end up with  a couple dozen tables so just want to make sure this is an okay way to organize the app.

Thanks

2015-08-03 10:08 GMT-05:00 Daniel Perrett <dp13@sanger.ac.uk>:

You probably want a second call to simple_crud, as all you’re doing in the second example is overwriting the keys in the hash that is created from the arguments to simple_crud.

 

Daniel

 

From: dancer-users [mailto:dancer-users-bounces@dancer.pm] On Behalf Of Richard Reina
Sent: 03 August 2015 15:46
To: Perl Dancer users mailing list
Subject: [dancer-users] Adding a second route to a simple crud.

 

When I do this it works.
 
#!/usr/bin/perl
 
use Dancer;
use Dancer::Plugin::SimpleCRUD;
 
# Simple example:
 
simple_crud(
 
       record_title => 'Sponsor',
    prefix => '/sponsor',
    db_table => 'patron',
    editable => 1,
    deletable => 'no',
    sortable => 'yes',
    labels => {     # More human-friendly labels for some columns
        ID => 'Player ID',
        first_name => 'First Name',
        last_name => 'Last Name',
        email => 'Email',
 
    }, 
 
);
 
dance;
 
But, when I add a second record/route --like below. The second one works but the first does not.
 
richard@gemini:~$ wget -O - http://0.0.0:3000/sponsor
--2015-08-03 09:19:22--  http://0.0.0:3000/sponsor
Resolving 0.0.0 (0.0.0)... 0.0.0.0
Connecting to 0.0.0 (0.0.0)|0.0.0.0|:3000... connected.
HTTP request sent, awaiting response... 404 Not Found
2015-08-03 09:19:22 ERROR 404: Not Found.
 
 
Any insight as to what I am doing wrong? Thanks.
 
#!/usr/bin/perl
 
use Dancer;
use Dancer::Plugin::SimpleCRUD;
 
# Simple example:
 
simple_crud(
 
    record_title => 'Sponsor',
    prefix => '/sponsor',
    db_table => 'patron',
    editable => 1,
    deletable => 'no',
    sortable => 'yes',
    labels => {     # More human-friendly labels for some columns
        ID => 'Player ID',
        first_name => 'First Name',
        last_name => 'Last Name',
        email => 'Email',
 
    }, 
 
 
    record_title => 'Player',
    prefix => '/player',
         
   db_table => 'jugador',
    editable => 1,
    deletable => 'no',
    sortable => 'yes',
     labels => {     # More human-friendly labels for some columns
        ID => 'Player ID',
        first_name => 'First Name',
        last_name => 'Last Name',
        SEX => 'Gender',
        email => 'Email',
 
   }, 
 
 
);
 
dance;

_______________________________________________
dancer-users mailing list
dancer-users@dancer.pm
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users