munkiserver
munkiserver copied to clipboard
View exception raised when hitting a computer show URL w/o a valid session
This is occurring the log message that occurs when I copy/paste a URL from a browser that with a valid session to another browser without a valid session.
Started GET "/it-burnaby/computers/aisg-0371" for 142.58.3.168 at 2012-01-09 14:39:43 -0800
Processing by ComputersController#show as HTML
Parameters: {"unit_shortname"=>"it-burnaby", "id"=>"aisg-0371"}
Rendered shared/_record_header.html.erb (2.6ms)
Rendered shared/_inventory.html.erb (7.8ms)
Rendered shared/_pkg_list.html.erb (215.6ms)
Rendered shared/_pkg_list.html.erb (87.4ms)
Rendered shared/_bundle_list.html.erb (460.5ms)
Rendered shared/_pkg_list.html.erb (12.6ms)
Rendered shared/_inventory.html.erb (478.0ms)
Rendered computers/_system_profile.html.erb (508.6ms)
Rendered shared/_helpful_info.html.erb (0.3ms)
Rendered computers/_warranty_status.html.erb (0.3ms)
Rendered computers/_warranty.html.erb (2.2ms)
Rendered shared/_pkg_list.html.erb (235.3ms)
Rendered computers/show.html.erb within layouts/application (2144.9ms)
Completed 500 Internal Server Error in 2154ms
ActionView::Template::Error (undefined method `units' for nil:NilClass):
77:
78: <div id="unit_menu" class="span-24 last">
79: <ul>
80: <%= unit_menu %>
81: </ul>
82: </div>
83:
app/helpers/application_helper.rb:131:in `unit_menu'
app/views/layouts/application.html.erb:80:in `_app_views_layouts_application_html_erb__2377828628238572919_2167832060_545330052087661708'
app/controllers/computers_controller.rb:48:in `show'
Perhaps the before_filters are redirecting the user to the login page and an error happens to be raised because there are no units for this user because there is no user.
I ran into this exact error when "current_user" was not known when testing the use of Devise for authentication.
With Devise it provides a helper method "authenticated_user!" that is added as a before_filter to anything you want require authentication. So adding that to the application controller ensured that everything required authentication.
I'll run a test of trying to access a computer's show view with Devise and see if that fixes this error.