Your best bet is to set up the Episode card like usual:
<def tag="card" for="Episode">
..etc..
</def>
Then PlaylistEpisode (which I'm assuming has_one or belongs_to Episode)
<def tag="card" for="PlaylistEpisode">
<card:episode merge>
...do some stuff here...
</card>
</def>
The only messy thing is that you'll have to (I think) refer to the
PlaylistEpisode in the second part as this_parent.
If I've mis-guessed, and PlaylistEpisode is a subclass of Episode,
then you'll want to do this:
<def tag="card" for="PlaylistEpisode">
<card for-type="Episode">
... do stuff here if PlaylistEpisode is a subclass of Episode
</card>
</def>
The cookbook section on polymorphic tags is pretty handy here too.
--Matt Jones
On Aug 28, 2009, at 3:31 AM, Scott Bronson wrote:
> I'd like to have two different models, Episode and PlaylistEpisode,
> share the same card definition.
>
>
> This dies with a stack too deep error:
>
> <def tag="episode-card">
> <card class="episode" merge>
> <header:>
> <h4 param="heading"><a:show/> -- <a><name/></a></h4>
> </header:>
> </card>
> </def>
>
> <def tag="card" for="Episode">
> <episode-card merge/>
> </def>
>
> <def tag="card" for="PlaylistEpisode">
> <episode-card:episode merge/>
> </def>
>
>
>
> This works but isn't very dry:
>
> <def tag="episode-card">
> <header:>
> <h4 param="heading"><a:show/> -- <a><name/></a></h4>
> </header:>
> </def>
>
> <def tag="card" for="Episode">
> <card class="episode" merge>
> <episode-card merge/>
> </card>
> </def>
>
> <def tag="card" for="PlaylistEpisode">
> <card class="episode" merge>
> <episode-card:episode merge/>
> </card>
> </def>
>
>
> I tried explicitly calling the base card; it still blows the stack:
> <card class="episode" for-type="&nil" merge>
>
> I'm not quite sure why moving the call to the base card would fix
> the recursion error... Does Hobo explicitly prevent self recursion?
>
> And, can anyone suggest a better way of doing this? Thanks!
>
> - Scott
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---