Bill, that doesn't seem to be working. It seemed to be at first until I
tried to do more with the application.
My shared/_task_orders.html.erb
<ul type="none">
<% @all_task_orders.each do |task_order| %>
<% unless task_order.year != @last_task_order.year %>
<li>     <%=h link_to "#{task_order.name}",
task_order_criteria_path(task_order) %> - <%=h task_order.year %> Q<%=h
task_order.quarter %></li>
<% end %>
<% end %>
</ul>
<br />
My task_orders_controller
class TaskOrdersController < ApplicationController
...
def index
@task_orders = TaskOrder.search(params[:search], params[:page])
@last_task_order = TaskOrder.find(:first)
@all_task_orders = TaskOrder.all
end
...
end
I'm getting:
NoMethodError in Criteria#index
Showing app/views/shared/_task_orders.html.erb where line #2 raised:
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.each
Extracted source (around line #2):
1: <ul type="none">
2: <% @all_task_orders.each do |task_order| %>
3: <% unless task_order.year != @last_task_order.year %>
4: <li>     <%=h link_to "#{task_order.name}",
task_order_criteria_path(task_order) %> - <%=h task_order.year %> Q<%=h
task_order.quarter %></li>
5: <% end %>
Thank you for helping me!!
Andrew Davis
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment