/Users/mraible/dev/play-more/app/controllers/Home.scala:10: not found:
value render
render('athlete -> athlete)
^
/Users/mraible/dev/play-more/app/controllers/Home.scala:14: not found:
value render
render()
^
/Users/mraible/dev/play-more/app/controllers/Home.scala:18: not found:
value render
render()
^
three errors found
The ScalaController type doesn't define any render method right?
The problem is that in Play 1.2, the Plugin API was designed for the Java API, and then we started to experiment in a separate module with scala. So most methods of the Plugin API are not relevant for the Scala API.
Btw, that's why we started Play 2.0 to clean all this stuff and have 2 API at the same level with a proper Plugin mechanism.
In the meantime you should just provide a trait in your jade module. It is probably the easiest and cleanest way to handle it.
> /Users/mraible/dev/play-more/app/controllers/Home.scala:10: not found: > value render > render('athlete -> athlete) > ^ > /Users/mraible/dev/play-more/app/controllers/Home.scala:14: not found: > value render > render() > ^ > /Users/mraible/dev/play-more/app/controllers/Home.scala:18: not found: > value render > render() > ^ > three errors found
> Any ideas?
> Thanks,
> Matt
> -- > You received this message because you are subscribed to the Google Groups "play-framework" group. > 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.
Copying my trait to a plugin solved the problem. However, I'd also like to try and override the default behavior (rending a Template with Template() instead of render()). I've gotten close, but can't figure out how to turn a java.util.Map into (Symbol, Any).
> The ScalaController type doesn't define any render method right?
> The problem is that in Play 1.2, the Plugin API was designed for the > Java API, and then we started to experiment in a separate module with > scala. So most methods of the Plugin API are not relevant for the > Scala API.
> Btw, that's why we started Play 2.0 to clean all this stuff and have 2 > API at the same level with a proper Plugin mechanism.
> In the meantime you should just provide a trait in your jade module. > It is probably the easiest and cleanest way to handle it.
> On Thu, Nov 3, 2011 at 4:28 PM, Matt Raible <mrai...@gmail.com> wrote: >> Hello all,
>> I'm trying to turn the following Scalate Trait into a Plugin.
>> /Users/mraible/dev/play-more/app/controllers/Home.scala:10: not found: >> value render >> render('athlete -> athlete) >> ^ >> /Users/mraible/dev/play-more/app/controllers/Home.scala:14: not found: >> value render >> render() >> ^ >> /Users/mraible/dev/play-more/app/controllers/Home.scala:18: not found: >> value render >> render() >> ^ >> three errors found
>> Any ideas?
>> Thanks,
>> Matt
>> -- >> You received this message because you are subscribed to the Google Groups "play-framework" group. >> 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.
> -- > You received this message because you are subscribed to the Google Groups "play-framework" group. > 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.
} On Fri, Nov 4, 2011 at 1:14 PM, Matt Raible <mrai...@gmail.com> wrote: > Copying my trait to a plugin solved the problem. However, I'd also like to > try and override the default behavior (rending a Template with Template() > instead of render()). I've gotten close, but can't figure out how to turn a > java.util.Map into (Symbol, Any).
> On Fri, Nov 4, 2011 at 1:14 PM, Matt Raible <mrai...@gmail.com> wrote: > Copying my trait to a plugin solved the problem. However, I'd also like to try and override the default behavior (rending a Template with Template() instead of render()). I've gotten close, but can't figure out how to turn a java.util.Map into (Symbol, Any).
> -- > You received this message because you are subscribed to the Google Groups "play-framework" group. > 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.
>> On Fri, Nov 4, 2011 at 1:14 PM, Matt Raible <mrai...@gmail.com> wrote: >> Copying my trait to a plugin solved the problem. However, I'd also like to try and override the default behavior (rending a Template with Template() instead of render()). I've gotten close, but can't figure out how to turn a java.util.Map into (Symbol, Any).
>> -- >> You received this message because you are subscribed to the Google Groups "play-framework" group. >> 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.
> -- > You received this message because you are subscribed to the Google Groups "play-framework" group. > 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.
I feel like I've tried everything. I spent several hours last night trying everything I could think of. Of course, it was from 12-3 am, so it could be something very simple that I missed. ;)
>>> On Fri, Nov 4, 2011 at 1:14 PM, Matt Raible <mrai...@gmail.com> wrote: >>> Copying my trait to a plugin solved the problem. However, I'd also like to try and override the default behavior (rending a Template with Template() instead of render()). I've gotten close, but can't figure out how to turn a java.util.Map into (Symbol, Any).
>>> -- >>> You received this message because you are subscribed to the Google Groups "play-framework" group. >>> 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.
>> -- >> You received this message because you are subscribed to the Google Groups "play-framework" group. >> 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.
> -- > You received this message because you are subscribed to the Google Groups "play-framework" group. > 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.
The compiler error suggests that you actually want a String. Perhaps you forgot to render the template using the Map[Symbol, Any]?
Your question was apparently asking how to convert a java.util.Map[String, AnyRef] to a Map[Symbol, Any], and that is what the snippet I sent does -- see below. Perhaps I misunderstood the question.
scala> val m = new java.util.HashMap[String, AnyRef] m: java.util.HashMap[String,AnyRef] = {}
> On Fri, Nov 4, 2011 at 1:14 PM, Matt Raible <mrai...@gmail.com> wrote:
>> Copying my trait to a plugin solved the problem. However, I'd also like >> to try and override the default behavior (rending a Template with >> Template() instead of render()). I've gotten close, but can't figure out >> how to turn a java.util.Map into (Symbol, Any).
> -- > You received this message because you are subscribed to the Google Groups > "play-framework" group. > 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.
> -- > You received this message because you are subscribed to the Google Groups > "play-framework" group. > 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.
> The compiler error suggests that you actually want a String. Perhaps you forgot to render the template using the Map[Symbol, Any]?
> Your question was apparently asking how to convert a java.util.Map[String, AnyRef] to a Map[Symbol, Any], and that is what the snippet I sent does -- see below. Perhaps I misunderstood the question.
> scala> val m = new java.util.HashMap[String, AnyRef] > m: java.util.HashMap[String,AnyRef] = {}
>> On Fri, Nov 4, 2011 at 1:14 PM, Matt Raible <mrai...@gmail.com> wrote: >> Copying my trait to a plugin solved the problem. However, I'd also like to try and override the default behavior (rending a Template with Template() instead of render()). I've gotten close, but can't figure out how to turn a java.util.Map into (Symbol, Any).
>> -- >> You received this message because you are subscribed to the Google Groups "play-framework" group. >> 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.
> -- > You received this message because you are subscribed to the Google Groups "play-framework" group. > 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.
> -- > You received this message because you are subscribed to the Google Groups "play-framework" group. > 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.
On Fri, Nov 4, 2011 at 3:53 PM, Matt Raible <mrai...@gmail.com> wrote: > The render method I'm trying to call takes the following:
> def render(args: (Symbol, Any)*)
In that case, you need a Seq[(Symbol, Any)], not a Map[Symbol, Any] or String. How about this, then?
render(convertMap(theMapToConvert).toSeq :_*)
The * in the render method's parameter list means "zero or more" (Symbol, Any) tuples -- in other words, it's Scala syntax for varargs. The :_* at the call site means "don't pass this collection as a single parameter, but rather pass each element that it contains as its own, separate parameter to the varargs method I'm calling".
[scalac] /Users/mraible/dev/play-scalate/src/play/modules/scalate/Plugin.scala:36: error: type mismatch; [scalac] found : Any [scalac] required: String [scalac] ScalateTemplate(template).render(map.toSeq :_*) [scalac] ^ [scalac] one error found
The ^ in my console points to the opening paren before map.toSeq
On Nov 4, 2011, at 2:23 PM, Matt Hildebrand wrote:
> On Fri, Nov 4, 2011 at 3:53 PM, Matt Raible <mrai...@gmail.com> wrote: > The render method I'm trying to call takes the following:
> def render(args: (Symbol, Any)*)
> In that case, you need a Seq[(Symbol, Any)], not a Map[Symbol, Any] or String. How about this, then?
> render(convertMap(theMapToConvert).toSeq :_*)
> The * in the render method's parameter list means "zero or more" (Symbol, Any) tuples -- in other words, it's Scala syntax for varargs. The :_* at the call site means "don't pass this collection as a single parameter, but rather pass each element that it contains as its own, separate parameter to the varargs method I'm calling".
> Cheers, > -Matt
> -- > You received this message because you are subscribed to the Google Groups "play-framework" group. > 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.