I have 2 different actions for a single controller (show and shirt_report). Each action has its own view. I have included the code for each below. The problem is that I am receiving an error when generating shirt_report, but not show, on my webserver running in production, but not on my laptop running in development. The error recieved is also listed below. Any help in clearing up this issue would be greatly appreciated. ===============Controller: class TeamController < ApplicationController def show @team = current_user.teams.find(params[:id]) end def shirt_report @team = current_user.teams.find(params[:id]) @players = @team.players.find(:all, :order => ''last_name ASC'') end end =============== View: show.rhtml <h1><%= @team.name %></h1> <% if !@team.players.empty? %> <h3>Roster</h3> <%= link_to '' (Shirt Report)'', :action => ''shirt_report'', :id => @team %> <div class="indent"> <table> <thead><td>Player Name</td><td>Height</td><td>Weight</td></thead> <tbody> <% @team.players.each do |player| %> <tr> <td> <%= link_to h(player.last_name) + '', '' + h(player.first_name), :controller => ''player'', :action => ''show'', :id => player %> </td> <td> <%= h player.height %> </td> <td> <%= h player.weight %> </td> </tr> <% end %> </tbody> </table> </div> <% end %> =============== View: shirt_report.rhtml <h3><%= @team.name %> Shirt Report</h3> <div class="indent"> <table> <thead><td>Player Name</td><td>Shirt Size</td></thead> <tbody> <% @players.each do |player| %> <tr> <td> <%= link_to h(player.last_name) + '', '' + h(player.first_name), :controller => ''player'', :action => ''show'', :id => player %> </td> <td> <%= h player.shirt_size %> </td> </tr> <% end %> </tbody> </table> </div> =============== The error when clicking on one of the links generated in show to get to the shirt_report: ActionView::TemplateError (undefined method `name'' for nil:NilClass) on line #1 of app/views/team/shirt_report.rhtml: 1: <h3><%= @team.name %> Shirt Report</h3> 2: <div class="indent"> 3: <table> 4: <thead><td>Player Name</td><td>Shirt Size</td></thead> #{RAILS_ROOT}/app/views/team/shirt_report.rhtml:1:in `_run_rhtml_47app47views47team47shirt_report46rhtml'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_view/base.rb:326:in `send'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_view/base.rb:326:in `compile_and_render_template'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_view/base.rb:301:in `render_template'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_view/base.rb:260:in `render_file'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:806:in `render_file'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:711:in `render_with_no_layout'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/layout.rb:247:in `render_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:50:in `render'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:50:in `render'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:1101:in `perform_action_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:632:in `call_filter'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:638:in `call_filter'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:438:in `call'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:637:in `call_filter'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:619:in `perform_action_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:66:in `perform_action_without_rescue'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:66:in `perform_action_without_rescue'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/rescue.rb:83:in `perform_action'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:430:in `send'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:430:in `process_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:624:in `process_without_session_management_support'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/session_management.rb:114:in `process'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:330:in `process'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb: 41:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: 168:in `process_request'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: 143:in `process_each_request!'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: 109:in `with_signal_handler'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: 142:in `process_each_request!'' /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in `each_cgi'' /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in `each'' /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in `each_cgi'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: 141:in `process_each_request!'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: 55:in `process!'' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: 25:in `process!'' dispatch.fcgi:24 =============== -Adam Klunick --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Production doesnt have the same ''team'' data that development has? - Richard On Jun 4, 2:24 pm, Adam Klunick <adam.robert.klun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have 2 different actions for a single controller (show and > shirt_report). Each action has its own view. I have included the > code for each below. The problem is that I am receiving an error when > generating shirt_report, but not show, on my webserver running in > production, but not on my laptop running in development. The error > recieved is also listed below. Any help in clearing up this issue > would be greatly appreciated. > > ===============> Controller: > > class TeamController < ApplicationController > > def show > @team = current_user.teams.find(params[:id]) > end > > def shirt_report > @team = current_user.teams.find(params[:id]) > @players = @team.players.find(:all, :order => ''last_name ASC'') > end > > end > > ===============> > View: show.rhtml > > <h1><%= @team.name %></h1> > <% if !...@team.players.empty? %> > <h3>Roster</h3> > <%= link_to '' (Shirt Report)'', > :action => ''shirt_report'', > :id => @team %> > <div class="indent"> > <table> > <thead><td>Player Name</td><td>Height</td><td>Weight</td></thead> > <tbody> > <% @team.players.each do |player| %> > <tr> > <td> > <%= link_to h(player.last_name) + '', '' + > h(player.first_name), > :controller => ''player'', > :action => ''show'', > :id => player %> > </td> > <td> > <%= h player.height %> > </td> > <td> > <%= h player.weight %> > </td> > </tr> > <% end %> > </tbody> > </table> > </div> > <% end %> > > ===============> > View: shirt_report.rhtml > > <h3><%= @team.name %> Shirt Report</h3> > <div class="indent"> > <table> > <thead><td>Player Name</td><td>Shirt Size</td></thead> > <tbody> > <% @players.each do |player| %> > <tr> > <td> > <%= link_to h(player.last_name) + '', '' + h(player.first_name), > :controller => ''player'', > :action => ''show'', > :id => player %> > </td> > <td> > <%= h player.shirt_size %> > </td> > </tr> > <% end %> > </tbody> > </table> > </div> > > ===============> > The error when clicking on one of the links generated in show to get > to the shirt_report: > > ActionView::TemplateError (undefined method `name'' for nil:NilClass) > on line #1 of app/views/team/shirt_report.rhtml: > 1: <h3><%= @team.name %> Shirt Report</h3> > 2: <div class="indent"> > 3: <table> > 4: <thead><td>Player Name</td><td>Shirt Size</td></thead> > > #{RAILS_ROOT}/app/views/team/shirt_report.rhtml:1:in > `_run_rhtml_47app47views47team47shirt_report46rhtml'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_view/base.rb:326:in `send'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_view/base.rb:326:in `compile_and_render_template'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_view/base.rb:301:in `render_template'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_view/base.rb:260:in `render_file'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/base.rb:806:in `render_file'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/base.rb:711:in `render_with_no_layout'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/layout.rb:247:in `render_without_benchmark'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/benchmarking.rb:50:in `render'' > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/benchmarking.rb:50:in `render'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/base.rb:1101:in `perform_action_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/filters.rb:632:in `call_filter'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/filters.rb:638:in `call_filter'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/filters.rb:438:in `call'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/filters.rb:637:in `call_filter'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/filters.rb:619:in `perform_action_without_benchmark'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/benchmarking.rb:66:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/benchmarking.rb:66:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/rescue.rb:83:in `perform_action'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/base.rb:430:in `send'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/base.rb:430:in `process_without_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/filters.rb:624:in > `process_without_session_management_support'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/session_management.rb:114:in `process'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/base.rb:330:in `process'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb: > 41:in `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > 168:in `process_request'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > 143:in `process_each_request!'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > 109:in `with_signal_handler'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > 142:in `process_each_request!'' > /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in > `each_cgi'' > /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in > `each'' > /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in > `each_cgi'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > 141:in `process_each_request!'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > 55:in `process!'' > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > 25:in `process!'' > dispatch.fcgi:24 > > ===============> > -Adam Klunick--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
If you notice, there is a reference to @team.name in both show and shirt_report. Show works but shirt_report does not. On Jun 4, 4:35 pm, Richard Luther <richard.lut...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Production doesnt have the same ''team'' data that development has? > - Richard > > On Jun 4, 2:24 pm, Adam Klunick <adam.robert.klun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I have 2 different actions for a single controller (show and > > shirt_report). Each action has its own view. I have included the > > code for each below. The problem is that I am receiving an error when > > generating shirt_report, but not show, on my webserver running in > > production, but not on my laptop running in development. The error > > recieved is also listed below. Any help in clearing up this issue > > would be greatly appreciated. > > > ===============> > Controller: > > > class TeamController < ApplicationController > > > def show > > @team = current_user.teams.find(params[:id]) > > end > > > def shirt_report > > @team = current_user.teams.find(params[:id]) > > @players = @team.players.find(:all, :order => ''last_name ASC'') > > end > > > end > > > ===============> > > View: show.rhtml > > > <h1><%= @team.name %></h1> > > <% if !...@team.players.empty? %> > > <h3>Roster</h3> > > <%= link_to '' (Shirt Report)'', > > :action => ''shirt_report'', > > :id => @team %> > > <div class="indent"> > > <table> > > <thead><td>Player Name</td><td>Height</td><td>Weight</td></thead> > > <tbody> > > <% @team.players.each do |player| %> > > <tr> > > <td> > > <%= link_to h(player.last_name) + '', '' + > > h(player.first_name), > > :controller => ''player'', > > :action => ''show'', > > :id => player %> > > </td> > > <td> > > <%= h player.height %> > > </td> > > <td> > > <%= h player.weight %> > > </td> > > </tr> > > <% end %> > > </tbody> > > </table> > > </div> > > <% end %> > > > ===============> > > View: shirt_report.rhtml > > > <h3><%= @team.name %> Shirt Report</h3> > > <div class="indent"> > > <table> > > <thead><td>Player Name</td><td>Shirt Size</td></thead> > > <tbody> > > <% @players.each do |player| %> > > <tr> > > <td> > > <%= link_to h(player.last_name) + '', '' + h(player.first_name), > > :controller => ''player'', > > :action => ''show'', > > :id => player %> > > </td> > > <td> > > <%= h player.shirt_size %> > > </td> > > </tr> > > <% end %> > > </tbody> > > </table> > > </div> > > > ===============> > > The error when clicking on one of the links generated in show to get > > to the shirt_report: > > > ActionView::TemplateError (undefined method `name'' for nil:NilClass) > > on line #1 of app/views/team/shirt_report.rhtml: > > 1: <h3><%= @team.name %> Shirt Report</h3> > > 2: <div class="indent"> > > 3: <table> > > 4: <thead><td>Player Name</td><td>Shirt Size</td></thead> > > > #{RAILS_ROOT}/app/views/team/shirt_report.rhtml:1:in > > `_run_rhtml_47app47views47team47shirt_report46rhtml'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_view/base.rb:326:in `send'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_view/base.rb:326:in `compile_and_render_template'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_view/base.rb:301:in `render_template'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_view/base.rb:260:in `render_file'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/base.rb:806:in `render_file'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/base.rb:711:in `render_with_no_layout'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/layout.rb:247:in `render_without_benchmark'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/benchmarking.rb:50:in `render'' > > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/benchmarking.rb:50:in `render'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/base.rb:1101:in `perform_action_without_filters'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/filters.rb:632:in `call_filter'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/filters.rb:638:in `call_filter'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/filters.rb:438:in `call'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/filters.rb:637:in `call_filter'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/filters.rb:619:in `perform_action_without_benchmark'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/benchmarking.rb:66:in > > `perform_action_without_rescue'' > > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/benchmarking.rb:66:in > > `perform_action_without_rescue'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/rescue.rb:83:in `perform_action'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/base.rb:430:in `send'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/base.rb:430:in `process_without_filters'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/filters.rb:624:in > > `process_without_session_management_support'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/session_management.rb:114:in `process'' > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > action_controller/base.rb:330:in `process'' > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb: > > 41:in `dispatch'' > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > 168:in `process_request'' > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > 143:in `process_each_request!'' > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > 109:in `with_signal_handler'' > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > 142:in `process_each_request!'' > > /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in > > `each_cgi'' > > /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in > > `each'' > > /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in > > `each_cgi'' > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > 141:in `process_each_request!'' > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > 55:in `process!'' > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > 25:in `process!'' > > dispatch.fcgi:24 > > > ===============> > > -Adam Klunick--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, In your show.rhtml you have: View: show.rhtml <h1><%= @team.name %></h1> <% if !...@team.players.empty? %> <h3>Roster</h3> <%= link_to '' (Shirt Report)'', :action => ''shirt_report'', :id => @team %> <div class="indent"> <table> ... ... Your link_to you have :id => @team, which should really be @team.id, otherwise you''re trying to pass the object @team, and not the id value for it. John. On Jun 4, 5:47 pm, Adam Klunick <adam.robert.klun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If you notice, there is a reference to @team.name in both show and > shirt_report. Show works but shirt_report does not. > > On Jun 4, 4:35 pm, Richard Luther <richard.lut...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Production doesnt have the same ''team'' data that development has? > > - Richard > > > On Jun 4, 2:24 pm, Adam Klunick <adam.robert.klun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I have 2 different actions for a single controller (show and > > > shirt_report). Each action has its own view. I have included the > > > code for each below. The problem is that I am receiving an error when > > > generating shirt_report, but not show, on my webserver running in > > > production, but not on my laptop running in development. The error > > > recieved is also listed below. Any help in clearing up this issue > > > would be greatly appreciated. > > > > ===============> > > Controller: > > > > class TeamController < ApplicationController > > > > def show > > > @team = current_user.teams.find(params[:id]) > > > end > > > > def shirt_report > > > @team = current_user.teams.find(params[:id]) > > > @players = @team.players.find(:all, :order => ''last_name ASC'') > > > end > > > > end > > > > ===============> > > > View: show.rhtml > > > > <h1><%= @team.name %></h1> > > > <% if !...@team.players.empty? %> > > > <h3>Roster</h3> > > > <%= link_to '' (Shirt Report)'', > > > :action => ''shirt_report'', > > > :id => @team %> > > > <div class="indent"> > > > <table> > > > <thead><td>Player Name</td><td>Height</td><td>Weight</td></thead> > > > <tbody> > > > <% @team.players.each do |player| %> > > > <tr> > > > <td> > > > <%= link_to h(player.last_name) + '', '' + > > > h(player.first_name), > > > :controller => ''player'', > > > :action => ''show'', > > > :id => player %> > > > </td> > > > <td> > > > <%= h player.height %> > > > </td> > > > <td> > > > <%= h player.weight %> > > > </td> > > > </tr> > > > <% end %> > > > </tbody> > > > </table> > > > </div> > > > <% end %> > > > > ===============> > > > View: shirt_report.rhtml > > > > <h3><%= @team.name %> Shirt Report</h3> > > > <div class="indent"> > > > <table> > > > <thead><td>Player Name</td><td>Shirt Size</td></thead> > > > <tbody> > > > <% @players.each do |player| %> > > > <tr> > > > <td> > > > <%= link_to h(player.last_name) + '', '' + h(player.first_name), > > > :controller => ''player'', > > > :action => ''show'', > > > :id => player %> > > > </td> > > > <td> > > > <%= h player.shirt_size %> > > > </td> > > > </tr> > > > <% end %> > > > </tbody> > > > </table> > > > </div> > > > > ===============> > > > The error when clicking on one of the links generated in show to get > > > to the shirt_report: > > > > ActionView::TemplateError (undefined method `name'' for nil:NilClass) > > > on line #1 of app/views/team/shirt_report.rhtml: > > > 1: <h3><%= @team.name %> Shirt Report</h3> > > > 2: <div class="indent"> > > > 3: <table> > > > 4: <thead><td>Player Name</td><td>Shirt Size</td></thead> > > > > #{RAILS_ROOT}/app/views/team/shirt_report.rhtml:1:in > > > `_run_rhtml_47app47views47team47shirt_report46rhtml'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_view/base.rb:326:in `send'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_view/base.rb:326:in `compile_and_render_template'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_view/base.rb:301:in `render_template'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_view/base.rb:260:in `render_file'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/base.rb:806:in `render_file'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/base.rb:711:in `render_with_no_layout'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/layout.rb:247:in `render_without_benchmark'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/benchmarking.rb:50:in `render'' > > > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/benchmarking.rb:50:in `render'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/base.rb:1101:in `perform_action_without_filters'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/filters.rb:632:in `call_filter'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/filters.rb:638:in `call_filter'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/filters.rb:438:in `call'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/filters.rb:637:in `call_filter'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/filters.rb:619:in `perform_action_without_benchmark'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/benchmarking.rb:66:in > > > `perform_action_without_rescue'' > > > /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/benchmarking.rb:66:in > > > `perform_action_without_rescue'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/rescue.rb:83:in `perform_action'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/base.rb:430:in `send'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/base.rb:430:in `process_without_filters'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/filters.rb:624:in > > > `process_without_session_management_support'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/session_management.rb:114:in `process'' > > > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > > > action_controller/base.rb:330:in `process'' > > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb: > > > 41:in `dispatch'' > > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > > 168:in `process_request'' > > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > > 143:in `process_each_request!'' > > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > > 109:in `with_signal_handler'' > > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > > 142:in `process_each_request!'' > > > /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in > > > `each_cgi'' > > > /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in > > > `each'' > > > /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in > > > `each_cgi'' > > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > > 141:in `process_each_request!'' > > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > > 55:in `process!'' > > > /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb: > > > 25:in `process!'' > > > dispatch.fcgi:24 > > > > ===============> > > > -Adam Klunick--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/4/07, John <manjiro-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > In your show.rhtml you have: > > View: show.rhtml > > <h1><%= @team.name %></h1> > <% if !...@team.players.empty? %> > <h3>Roster</h3> > <%= link_to '' (Shirt Report)'', > :action => ''shirt_report'', > :id => @team %> > <div class="indent"> > <table> > ... > ... > > Your link_to you have :id => @team, which should really be @team.id, > otherwise you''re trying to pass the object @team, and not the id value > for it. > > John.Routes call an implicit #to_param method on values, which is mapped to #id on AR models by default. His code is fine, and has nothing to do with the error. -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 4, 2007, at 5:24 PM, Adam Klunick wrote:> > I have 2 different actions for a single controller (show and > shirt_report). Each action has its own view. I have included the > code for each below. The problem is that I am receiving an error when > generating shirt_report, but not show, on my webserver running in > production, but not on my laptop running in development. The error > recieved is also listed below. Any help in clearing up this issue > would be greatly appreciated. > > ===============> Controller: > > class TeamController < ApplicationController > > def show > @team = current_user.teams.find(params[:id]) > end > > def shirt_report > @team = current_user.teams.find(params[:id]) > @players = @team.players.find(:all, :order => ''last_name ASC'') > end > > end > > ===============> > View: show.rhtml > > <h1><%= @team.name %></h1> > <% if !@team.players.empty? %> > <h3>Roster</h3> > <%= link_to '' (Shirt Report)'', > :action => ''shirt_report'', > :id => @team %> > <div class="indent"> > <table> > <thead><td>Player Name</td><td>Height</td><td>Weight</td></thead> > <tbody> > <% @team.players.each do |player| %> > <tr> > <td> > <%= link_to h(player.last_name) + '', '' + > h(player.first_name), > :controller => ''player'', > :action => ''show'', > :id => player %>Are you talking about THIS link? Because /player/show/:id seems to expect that the :id is for a TEAM, not a player. And the use of :id => some_object calls the .to_param method of some_object which, by default, does .id Perhaps you meant for for your controller action to be: def show @team = current_user.teams.find(params[:id]) @player = @team.players.find(params[:player]) end and in the view: <%= link_to player.full_name, :controller => ''player'', :action => ''show'', :id => @team, :player => player %> And I''d suggest: class Player def roster_name "#{self.last_name}, #{self.first_name}" end end> </td> > <td> > <%= h player.height %> > </td> > <td> > <%= h player.weight %> > </td> > </tr> > <% end %> > </tbody> > </table> > </div> > <% end %> > > ===============> > View: shirt_report.rhtml > > <h3><%= @team.name %> Shirt Report</h3> > <div class="indent"> > <table> > <thead><td>Player Name</td><td>Shirt Size</td></thead> > <tbody> > <% @players.each do |player| %> > <tr> > <td> > <%= link_to h(player.last_name) + '', '' + h(player.first_name), > :controller => ''player'', > :action => ''show'', > :id => player %> > </td> > <td> > <%= h player.shirt_size %> > </td> > </tr> > <% end %> > </tbody> > </table> > </div> > > ===============> > -Adam Klunick-Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
OR, should you show us the PlayerController#show as well? On Jun 4, 2007, at 7:08 PM, Rob Biedenharn wrote:> > On Jun 4, 2007, at 5:24 PM, Adam Klunick wrote: > >> >> I have 2 different actions for a single controller (show and >> shirt_report). Each action has its own view. I have included the >> code for each below. The problem is that I am receiving an error >> when >> generating shirt_report, but not show, on my webserver running in >> production, but not on my laptop running in development. The error >> recieved is also listed below. Any help in clearing up this issue >> would be greatly appreciated. >> >> ===============>> Controller: >> >> class TeamController < ApplicationController >> >> def show >> @team = current_user.teams.find(params[:id]) >> end >> >> def shirt_report >> @team = current_user.teams.find(params[:id]) >> @players = @team.players.find(:all, :order => ''last_name ASC'') >> end >> >> end >> >> ===============>> >> View: show.rhtml >> >> <h1><%= @team.name %></h1> >> <% if !@team.players.empty? %> >> <h3>Roster</h3> >> <%= link_to '' (Shirt Report)'', >> :action => ''shirt_report'', >> :id => @team %> >> <div class="indent"> >> <table> >> <thead><td>Player Name</td><td>Height</td><td>Weight</td></thead> >> <tbody> >> <% @team.players.each do |player| %> >> <tr> >> <td> >> <%= link_to h(player.last_name) + '', '' + >> h(player.first_name), >> :controller => ''player'', >> :action => ''show'', >> :id => player %> > Are you talking about THIS link? > Because /player/show/:id seems to expect that the :id is for a > TEAM, not a player. > > And the use of > :id => some_object > calls the .to_param method of some_object which, by default, does .id > > Perhaps you meant for for your controller action to be: > def show > @team = current_user.teams.find(params[:id]) > @player = @team.players.find(params[:player]) > end > > and in the view: > <%= link_to player.full_name, > :controller => ''player'', > :action => ''show'', > :id => @team, > :player => player %> > > And I''d suggest: > class Player > def roster_name > "#{self.last_name}, #{self.first_name}" > end > end > >> </td> >> <td> >> <%= h player.height %> >> </td> >> <td> >> <%= h player.weight %> >> </td> >> </tr> >> <% end %> >> </tbody> >> </table> >> </div> >> <% end %> >> >> ===============>> >> View: shirt_report.rhtml >> >> <h3><%= @team.name %> Shirt Report</h3> >> <div class="indent"> >> <table> >> <thead><td>Player Name</td><td>Shirt Size</td></thead> >> <tbody> >> <% @players.each do |player| %> >> <tr> >> <td> >> <%= link_to h(player.last_name) + '', '' + h >> (player.first_name), >> :controller => ''player'', >> :action => ''show'', >> :id => player %> >> </td> >> <td> >> <%= h player.shirt_size %> >> </td> >> </tr> >> <% end %> >> </tbody> >> </table> >> </div> >> >> ===============>> >> -Adam Klunick > > -Rob > > Rob Biedenharn http://agileconsultingllc.com > Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org > >Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org +1 513-295-4739 Skype: rob.biedenharn --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---