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:
:action => βeditβ, :id => gtype.id %>
34:
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? ? ββ: ββ) +
options_for_select(gtype.articletypesizes.collect{|g| [g.size.name,
g.id]}, t) %>
37:
38:
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
surname
flash: !map:ActionController::Flash::FlashHash {}
Response
Headers: {βcookieβ=>[], βContent-Typeβ=>βtext/html; charset=utf-8β,
βCache-Controlβ=>βno-cacheβ}