Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActionView::PathSet .exists? fails due to nil array

#4511

This method fails: http://github.com/rails/rails/blob/master/actionpack/lib/action_vie...

Due to the error evaluating an empty array: "occurred while evaluating nil.empty?"

The empty array is here: http://github.com/rails/rails/blob/master/actionpack/lib/action_vie...

seems like "unless prefix.empty?" should be just "unless prefix"

Reported by Mario Olivio Flores · April 30th, 2010 @ 02:52 PM

State: resolved
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Tanel Suurhans
    Tanel Suurhans

    Probably needs a bit more information to write a failing test-case. The fix in itself looks easy enough.

    April 30th, 2010 @ 10:39 PM

  2. Ryan Bigg
    Ryan Bigg
    • State changed from new to open

    Please provide a way to duplicate this method failure.

    May 25th, 2010 @ 09:58 AM

  3. Mario Olivio Flores
    Mario Olivio Flores

    You could submit any value to view_paths.exists? and it will fail.

    Here is my example. I am using a pages_controller, to manage my static pages. Before attempting to load a template, I want my app to ensure the template exists, using a before filter.

    class PagesController < ApplicationController
      unloadable
      before_filter :ensure_valid
    
      def show
        render :template => current_page
      end
    
      protected
    
      def ensure_valid
        unless view_paths.exists?(current_page)
          render :nothing => true, :status => 404 and return false
        end
      end
    
      def current_page
        "pages/#{params[:id].to_s.downcase}"
      end
    end
    

    June 14th, 2010 @ 02:23 AM

  4. José Valim
    José Valim
    • State changed from open to resolved

    Fixed on master.

    June 22nd, 2010 @ 04:24 PM