#784 open
Iain

empty-collection-message tag fails unless member_class is defined

Reported by Iain | August 16th, 2010 @ 01:11 AM | in Hobo 1.4

empty-collection-message is defined like this

<def tag='empty-collection-message'>
  <div class='empty-collection-message' param='default' style='#{&apos;display:none&apos; if !this.empty?}'>
    <ht key='#{this.member_class.name.tableize}.collection.empty_message'>
      No <collection-name lowercase/> to display
    </ht>
  </div>
</def>

Which means that member_class is not defined on an empty collection, and that collection is displayed using the collection (or table) tags then hobo will crash. The member_class attribute is only set when collections are retrieved from the database, but if the collection is modified after loading (eg. using map) or the collection is created "artificially" then member_class will not be set.

There are two workarounds to this - always defining empty-collection-message or setting member_class on your collections, but I think a better solution would just be to fix up the ht tag so that it can cope with collections that don't have member_class defined. However I'm not sure of the best way to do this... Just using the class name of the empty enumerable wouldn't be very helpful (it would give "No array to display" - perhaps the solution would be to change the message to "Nothing to display"?)

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Tags

Pages