Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate Admin area ( CRUD ) on Play Framework

I'm following the Official tutorial for creating a administration area. I did the first step correctly but when i extend my controller class to CRUD i got an error (Crud not found on the project) + Access denied when I access to http://localhost:9000/admin/. This is what I did:

  1. Enable the CRUD module for the application In the /conf/application.conf file, enable the CRUD module by adding this line:

    module.crud=${play.path}/modules/crud

    Import default CRUD routes

  2. In the conf/routes file, import the default module routes by adding this line:

    * /admin module:crud

  3. Create the Users controller

    package controllers;
    
    public class Users extends CRUD {
    
    }
    
  4. Restarted play & eclipse

Any suggestion to get the admin area work please ?

like image 582
Mooh Avatar asked Jan 20 '11 03:01

Mooh


3 Answers

Try running this command again

play eclipsify myApp 
like image 151
Regis Avatar answered Oct 19 '22 13:10

Regis


Thanks for the tip, play eclipsify made the trick but before, i had to resolve dependencies as they are now in the dependencies.yml file:

# Application dependencies

require:
    - play
    - play -> crud

Just launch "play dependencies myApp" and then eclipsify. Reload your project in Eclipse and it works.

Tested in latest (1.2.3)

Fabien

like image 42
fnicollet Avatar answered Oct 19 '22 13:10

fnicollet


This could be caused by several issues. Let me outline steps to validate your setup:

  1. Controller name must be plural (controllers/Users.java)
  2. Make sure you have model (models/User.java)
  3. Controller must extend CRUD
  4. run play dependencies
  5. run play eclipsify and re-import project (just in case)
  6. Annotate model with @Entity
  7. Routes for /admin must be before /{controller.action} ...
  8. application.conf must contain following line:
    module.crud=${play.path}/modules/crud</li>
    

Comments:

  • Used Play framework version 1.2.3 does not require to have crud in dependencies.yml
like image 3
vladaman Avatar answered Oct 19 '22 12:10

vladaman