Hello,
For a distribution system at work we created a webinterface in Rails.
Last week we upgraded Rails from 1.0.0 to 1.1.6. I know, we should have
done it earlier... ;)
Anyway. Since then, on most pages we get errors about objects returning
NIL. But before the upgrade, everything worked perfect. I can''t find
anything wrong in the code, but thats probably just me being a noob.
Has anyone got any great tips?
Regards,
Albert
NoMethodError in Articleusers#edit
Showing app/views/articleusers/_list_departments_and_sizes.rhtml where
line #36 raised:
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.name
Extracted source (around line #36):
33: <td><%= lnk_to gtype.name, :controller =>
''articletypes'',
:action => ''edit'', :id => gtype.id %></td>
34: <td>
35: <% t = @articletypesizes.select{|n| n.articletype_id
=gtype.id}.first.articletypesize_id.to_i rescue nil %>
36: <%= select_tag "sizes[#{gtype.id}]", (t.nil? ?
''<option
value="" selected="selected"></option>'':
'''') +
options_for_select(gtype.articletypesizes.collect{|g| [g.size.name,
g.id]}, t) %>
37: </td>
38: </tr>
39: <% end %>
Trace of template inclusion: /app/views/articleusers/edit.rhtml
RAILS_ROOT: /home/technico/projects/technico/public/../config/..
Application Trace | Framework Trace | Full Trace
#{RAILS_ROOT}/app/views/articleusers/_list_departments_and_sizes.rhtml:36:in
`_run_rhtml_articleusers__list_departments_and_sizes''
#{RAILS_ROOT}/app/views/articleusers/_list_departments_and_sizes.rhtml:36:in
`_run_rhtml_articleusers__list_departments_and_sizes''
#{RAILS_ROOT}/app/views/articleusers/_list_departments_and_sizes.rhtml:31:in
`_run_rhtml_articleusers__list_departments_and_sizes''
#{RAILS_ROOT}/app/views/articleusers/edit.rhtml:71:in
`_run_rhtml_articleusers_edit''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/associations/association_proxy.rb:110:in
`method_missing''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/associations/has_many_association.rb:90:in
`method_missing''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in
`compile_and_render_template''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in
`render_template''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in
`render_file''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:266:in
`render''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/partials.rb:59:in
`render_partial''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:29:in
`benchmark''
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure''
/usr/lib/ruby/1.8/benchmark.rb:307:in `realtime''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:29:in
`benchmark''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/partials.rb:58:in
`render_partial''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in
`compile_and_render_template''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in
`render_template''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in
`render_file''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:726:in
`render_file''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:648:in
`render_with_no_layout''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/layout.rb:245:in
`render_without_benchmark''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in
`render''
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in
`render''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:942:in
`perform_action_without_filters''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in
`perform_action_without_benchmark''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue''
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in
`perform_action''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in
`process_without_filters''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in
`process_without_session_management_support''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in
`process''
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in
`dispatch''
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:150:in
`process_request''
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:54:in
`process!''
/usr/lib/ruby/1.8/fcgi.rb:600:in `each_cgi''
/usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi''
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:53:in
`process!''
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:23:in
`process!''
/home/technico/projects/technico/public/dispatch.fcgi:24
#{RAILS_ROOT}/app/views/articleusers/_list_departments_and_sizes.rhtml:36:in
`_run_rhtml_articleusers__list_departments_and_sizes''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/associations/association_proxy.rb:110:in
`method_missing''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/associations/has_many_association.rb:90:in
`method_missing''
#{RAILS_ROOT}/app/views/articleusers/_list_departments_and_sizes.rhtml:36:in
`_run_rhtml_articleusers__list_departments_and_sizes''
#{RAILS_ROOT}/app/views/articleusers/_list_departments_and_sizes.rhtml:31:in
`_run_rhtml_articleusers__list_departments_and_sizes''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in
`compile_and_render_template''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in
`render_template''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in
`render_file''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:266:in
`render''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/partials.rb:59:in
`render_partial''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:29:in
`benchmark''
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure''
/usr/lib/ruby/1.8/benchmark.rb:307:in `realtime''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:29:in
`benchmark''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/partials.rb:58:in
`render_partial''
#{RAILS_ROOT}/app/views/articleusers/edit.rhtml:71:in
`_run_rhtml_articleusers_edit''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in
`compile_and_render_template''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in
`render_template''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in
`render_file''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:726:in
`render_file''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:648:in
`render_with_no_layout''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/layout.rb:245:in
`render_without_benchmark''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in
`render''
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in
`render''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:942:in
`perform_action_without_filters''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in
`perform_action_without_benchmark''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue''
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in
`perform_action''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in
`process_without_filters''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in
`process_without_session_management_support''
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in
`process''
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in
`dispatch''
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:150:in
`process_request''
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:54:in
`process!''
/usr/lib/ruby/1.8/fcgi.rb:600:in `each_cgi''
/usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi''
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:53:in
`process!''
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:23:in
`process!''
/home/technico/projects/technico/public/dispatch.fcgi:24
Request
Parameters: {"id"=>"181"}
Show session dump
---
user: !ruby/object:User
attributes:
language: Netherlands
deleted_on:
id: "2"
password: 3cbb9f188f1fb46186075e39237709810d198383
login: Albert
userprofile_id: "1"
userprofile: !ruby/object:Userprofile
attributes:
name: Administrator
id: "1"
deleted_on:
comment: Administrator access
userprivileges:
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "140"
subject: clientgroups
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "141"
subject: clients
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "142"
subject: clientdepartments
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "143"
subject: articleusers
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "144"
subject: articles
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "145"
subject: distributors
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "146"
subject: scanlocations
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "147"
subject: contracts
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "148"
subject: invoices
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "149"
subject: loadingadvice
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "150"
subject: logs
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "151"
subject: suppliers
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "152"
subject: cleaningmethodgroups
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "153"
subject: cleaningmethods
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "154"
subject: finishingmethods
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "155"
subject: sizes
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "156"
subject: colors
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "157"
subject: qualities
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "158"
subject: articlegroups
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "159"
subject: articletypes
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "160"
subject: articledamages
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "161"
subject: clienttypes
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "162"
subject: notifications
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "163"
subject: notificationreasons
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "164"
subject: notificationactions
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "165"
subject: userprofiles
deleted_on:
show: "1"
userprofile_id: "1"
- !ruby/object:Userprivilege
attributes:
new: "1"
delete: "1"
list: "1"
edit: "1"
id: "166"
subject: users
deleted_on:
show: "1"
userprofile_id: "1"
articleusers_sort:
:order: asc
:key: surname
flash: !map:ActionController::Flash::FlashHash {}
Response
Headers: {"cookie"=>[],
"Content-Type"=>"text/html; charset=utf-8",
"Cache-Control"=>"no-cache"}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---