Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

type "" is not a member of package controllers play framework

I'm following a tutorial of the Play Framework but I occurred in a problem, I wrote this object:

package controllers

import play.api.mvc._

object Tickets extends Controller {
  def ticketsAvailable = Action { request =>
    val availableTickets = 1000
    Ok(availableTickets.toString)
  }
}

and then add the routes:

GET     /tickets/available/         controllers.Tickets.ticketsAvailable

but when I compiled and received this error:

type Tickets is not a member of package controllers

Anyone can help me with an example of how i can fix this problem?

Thanks

like image 228
Piero Avatar asked Nov 18 '15 00:11

Piero


1 Answers

Change your object to a class, ie.

class Tickets extends Controller {

And of course Tickets.scala should be packaged under app/controllers.

like image 84
jacks Avatar answered Sep 27 '22 23:09

jacks