#1 ✓resolved
James

Unhandled exception raised when no metadata exists for a license

Reported by James | October 30th, 2008 @ 03:15 PM

Summary

When a license with no metadata value present, and the license is selected on an item (in Kete, for example), the acts_as_licensed plugin causes an uncaught exception to be raised, resulting in a error 500 in a production website.

Stack trace


ActionView::TemplateError (private method `gsub' called for nil:NilClass) on line #2 of topics/_license.html.erb:
1: <% cache_with_privacy(item, {:part => "secondary_content_license_metadata"}) do -%>
2: <% unless item.license_metadata.nil? -%>
3: <div class="secondary-content-section-wrapper">
4:   <div id="license-box" class="secondary-content-section">
5:     <div class="license"><%= item.license_metadata %></div>

    vendor/plugins/acts_as_licensed/lib/acts_as_licensed.rb:55:in `license_metadata'
    app/views/topics/_license.html.erb:2:in `_run_erb_47app47views47topics47_license46html46erb'
    vendor/rails/actionpack/lib/action_controller/caching/fragments.rb:72:in `call'
    vendor/rails/actionpack/lib/action_controller/caching/fragments.rb:72:in `fragment_for'
    vendor/rails/actionpack/lib/action_view/template_handlers/erb.rb:50:in `cache_fragment'
    vendor/rails/actionpack/lib/action_view/helpers/cache_helper.rb:36:in `cache'
    app/helpers/application_helper.rb:795:in `cache_with_privacy'

Comments and changes to this ticket

  • James

    James October 30th, 2008 @ 06:22 PM

    • State changed from “new” to “open”

    I've fixed this issue in acts_as_licensed master by adding logic so that when no meta-data is provided, stub meta-data is generated from the license name, URL, etc and used as the HTML output for the license.

    This still allows for custom license metadata and therefore custom XHTML output, but also allows or cases where no metadata is provided.

    See http://github.com/kete/acts_as_l... for details.

  • James

    James November 3rd, 2008 @ 12:49 PM

    • State changed from “open” to “resolved”

    Changes have been made which now resolve this issue.

    1. Meta-data is now generated automatically when none is provided by an administrator. This includes an IMG tag only when an image_url is provided.

    2. Validates have been added to ensure name, url, is_available and is_creative_commons fields are always entered.

    See http://github.com/kete/acts_as_l... for the latest commit log.

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 ยป

Acts As Licensed is a plugin which provides a basic content licensing system to community centred Ruby On Rails applications. The plugin includes a set of Creative Commons New Zealand and Australian licenses, which can be imported (excluding the No Derivative Works variant).

People watching this ticket

Pages