Hum, try the return explicitly:
def edit(id: Long): Result
It is a type inference problem, I will check why.
On Tue, Jul 3, 2012 at 6:18 PM, juhe <mirko...@gmail.com> wrote:
> def edit(id: Long) = Action {
> transaction {
> Citizen.findById(id) match {
> case None => NotFound("Citizen not found.")
> case Some(c) => Ok(views.html.edit(c))
> }
> }
> }
>
> with a code like this for some reason I get:
> type mismatch; found : play.api.mvc.SimpleResult[_ >: java.lang.String with
> play.api.templates.Html <: java.io.Serializable] required:
> play.api.mvc.SimpleResult[_1(in method edit)] where type _1(in method edit)
>>: java.lang.String with play.api.templates.Html <: java.io.Serializable
> Note: java.io.Serializable >: _1, but class SimpleResult is invariant in
> type A. You may wish to define A as -A instead. (SLS 4.5)
>
> Why is this? If I use the same Ok return outside matching it works fine.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/_w8rbwfAAM0J.
> To post to this group, send email to play-framework@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framework+unsubscribe@googlegroups.com.
>> > To post to this group, send email to play-framework@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > play-framework+unsubscribe@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/play-framework?hl=en.
>>
>>
>>
>> --
>> Guillaume Bort, http://guillaume.bort.fr
>
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/X9Klf5hbmLUJ.
>
> To post to this group, send email to play-framework@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framework+unsubscribe@googlegroups.com.
>>>>>> >> > play-framework@googlegroups.com.
>>>>>> >> > To unsubscribe from this group, send email to
>>>>>> >> > play-framework+unsubscribe@googlegroups.com.
>>>>>> >> > For more options, visit this group at
>>>>>> >> > http://groups.google.com/group/play-framework?hl=en.
>>>>>> >>
>>>>>> >>
>>>>>> >>
>>>>>> >> --
>>>>>> >> Guillaume Bort, http://guillaume.bort.fr
>>>>>> >
>>>>>> > --
>>>>>> > You received this message because you are subscribed to the Google
>>>>>> > Groups
>>>>>> > "play-framework" group.
>>>>>> > To view this discussion on the web visit
>>>>>> > https://groups.google.com/d/msg/play-framework/-/X9Klf5hbmLUJ.
>>>>>> >
>>>>>> > To post to this group, send email to
>>>>>> > play-framework@googlegroups.com.
>>>>>> > To unsubscribe from this group, send email to
>>>>>> > For more options, visit this group at
>>>>>> > http://groups.google.com/group/play-framework?hl=en.
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Guillaume Bort, http://guillaume.bort.fr
>
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/JvvIqW0Fd-UJ.
>
> To post to this group, send email to play-framework@googlegroups.com.
> To unsubscribe from this group, send email to