Request.request_uri in production environment?


#1

Hi,
What’s the problem with this line?

<%= ‘height=“750” valign=“top”’ if request.request_uri =~
/survey_result/i %>

No problem with development environment but when uploading to server I
get application error.

And is there a better way to do this?

Thanks


#2

Post the error and backtrace from the log.


– Tom M.


#3

seems the error is :
undefined local variable or method `request’
Isn’t request availabe to view?

Processing PagesController#show_page (for 217.219.250.157 at
2006-02-05 22:28:22) [GET]
Parameters: {“name”=>“home”, “action”=>“show_page”,
“controller”=>“pages”}
Rendering within layouts/surveys
Rendering pages/show_page

ActionView::TemplateError (undefined local variable or method
`request’ for #<#Class:0x607195bc:0x60719508>) on line #17 of
app/views/layouts/surveys.rhtml:
14:

<%= render(:partial => “shared/menu”)
%>

15:
16:
17: <td <%= ‘height=“750” valign=“top”’ if request.request_uri =~
/survey_result/i %>>
18: <%=
19: if session[:user_id]
20: render(:partial => “shared/admin_menu”)
../config/../app/views/layouts/surveys.rhtml:17
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_view/base.rb:269:in

compile_and_render_template' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_view/base.rb:245:inrender_template’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_view/base.rb:206:in
render_file' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/layout.rb:223:inrender_without_benchmark’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/benchmarking.rb:53:in
render' /usr/local/lib/ruby/1.8/benchmark.rb:293:inmeasure’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/benchmarking.rb:53:in
render' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:835:inperform_action_without_filters’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/filters.rb:295:in
perform_action_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
/usr/local/lib/ruby/1.8/benchmark.rb:293:in measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/rescue.rb:82:in
perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:365:inprocess_without_session_management_support’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/session_management.rb:116:in
process' /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.2/lib/dispatcher.rb:36:indispatch’
dispatch.cgi:10