Forum: Ruby on Rails request.request_uri in production environment?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Human D. (Guest)
on 2006-02-05 15:40
(Received via mailing list)
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
Tom M. (Guest)
on 2006-02-05 18:57
(Received via mailing list)
Post the error and backtrace from the log.

--
-- Tom M.
Human D. (Guest)
on 2006-02-05 19:39
(Received via mailing list)
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:     <td><div id="menu"><%= render(:partial => "shared/menu")
%></div></td>
15:   </tr>
16:   <tr>
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:in
`render_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:in
`render_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:in `measure'
    /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:in
`perform_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: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.10.2/lib/action_controller/benchmarking.rb:69:in
`perform_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:in
`process_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:in
`dispatch'
    dispatch.cgi:10
This topic is locked and can not be replied to.