briandoll/Rit

nil issue after creating plate

branch14 opened this issue · 4 comments

after rake db:migrate and rake db:seed everything seems fine until i create my first plate, then I get this

ActionView::TemplateError (You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.<=>) on line #5 of app/views/plates/_plate_filter.html.erb:
2:   <%- form_tag plates_path, :class => 'filter-form', :method => :get do -%>
3:   <ul class="plate-name-parts">
4:     <li><%= filter_select "fl", params[:fl], "layout_name" %></li>
5:     <li><%= filter_select "fi", params[:fi], "instance_name" %></li>
6:     <li><%= filter_select "fp", params[:fp], "plate_name" %></li>
7:     <li class="action"><%= submit_tag "Filter" %></li>
8:     <li class="action"><%= link_to "Clear", plates_path %></li>

Thanks for reporting, I can take a look at this tomorrow.

Fixed. There was an issue with the seed file setting the instance_name to nil. This wouldn't happen from the form.

I thought validates_format_of wouldn't allow nil but, as it turns out, if you allow "", you'll also allow nil, since nil.to_s == "".

branch14, just dump your db file and start again. Or set the instance_name for the seeded plate to "".

Thx kasima, great response time. Thx also for your work on being more 'platform agnostic'. That's basically what I did to set it up on my machine.