Defect #8477

Undefined method `html_safe!'

Added by Petr Pospisil about 8 years ago. Updated over 6 years ago.

Status:ClosedStart date:2011-05-31
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:-
Target version:-
Resolution:Invalid Affected version:1.2.0

Description

ActionView::TemplateError (undefined method `html_safe!' for #<String:0xb4de570>).

a lot of views (some are maybe from plugins) are buggy. What changed?

E.g. error: <%= f.select :tracker_id %>

History

#1 Updated by Petr Pospisil about 8 years ago

Are you sure you are still compatible with Ruby 1.8.7?

#3 Updated by Etienne Massip about 8 years ago

Petr Pospisil wrote:

Are you sure you are still compatible with Ruby 1.8.7?

Yes, I've been running trunk/1.2.0 with 1.8.7 (patch lvl 330) for a long time now without any error like this one.

Please give details according to SubmittingBugs.

#4 Updated by Demid Lupin about 8 years ago

In fresh install of redmine try to create user than go to http://localhost/redmine/users/USER_ID 3 for example and than 500 error

About your application's environment
Ruby version 1.8.7 (i486-linux)
RubyGems version 1.3.7
Rack version 1.1
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Edge Rails revision unknown
Application root /usr/share/redmine
Environment production
Database adapter mysql
Database schema version 20100819172912

$ mysql --version
mysql Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (i486) using readline 6.1

$ dpkg -s redmine
Package: redmine
Status: install ok installed
Architecture: all
Version: 1.0.1-1

ActionView::TemplateError (undefined method `html_safe' for "":String) on line #10 of app/views/users/show.rhtml:
7: <div class="splitcontentleft">
8: <ul>
9: <% unless @user.pref.hide_mail >
10: <li><
=l(:field_mail)%>: <%= mail_to(h(@user.mail), nil, :encode => 'javascript') ></li>
11: <
end >
12: <
for custom_value in @custom_values >
13: <
if !custom_value.value.blank? %>

/usr/lib/ruby/1.8/action_view/helpers/url_helper.rb:476:in `mail_to'
app/views/users/show.rhtml:10:in `_run_rhtml_app47views47users47show46rhtml'
/usr/lib/ruby/1.8/action_view/renderable.rb:34:in `send'
/usr/lib/ruby/1.8/action_view/renderable.rb:34:in `render'
/usr/lib/ruby/1.8/action_view/base.rb:306:in `with_template'
/usr/lib/ruby/1.8/action_view/renderable.rb:30:in `render'
/usr/lib/ruby/1.8/action_view/template.rb:205:in `render_template'
/usr/lib/ruby/1.8/action_view/base.rb:265:in `render'
/usr/lib/ruby/1.8/action_view/base.rb:348:in `_render_with_layout'
/usr/lib/ruby/1.8/action_view/base.rb:262:in `render'
/usr/lib/ruby/1.8/action_controller/base.rb:1250:in `render_for_file'
/usr/lib/ruby/1.8/action_controller/base.rb:987:in `render_without_benchmark'
/usr/lib/ruby/1.8/action_controller/benchmarking.rb:51:in `render'
/usr/lib/ruby/1.8/action_controller/benchmarking.rb:51:in `render'
app/controllers/users_controller.rb:68:in `show'
/usr/lib/ruby/1.8/action_controller/base.rb:1331:in `send'
/usr/lib/ruby/1.8/action_controller/base.rb:1331:in `perform_action_without_filters'
/usr/lib/ruby/1.8/action_controller/filters.rb:617:in `call_filters'
/usr/lib/ruby/1.8/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/usr/lib/ruby/1.8/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/usr/lib/ruby/1.8/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/usr/lib/ruby/1.8/action_controller/rescue.rb:160:in `perform_action_without_flash'
/usr/lib/ruby/1.8/action_controller/flash.rb:146:in `perform_action'
/usr/lib/ruby/1.8/action_controller/base.rb:532:in `send'
/usr/lib/ruby/1.8/action_controller/base.rb:532:in `process_without_filters'
/usr/lib/ruby/1.8/action_controller/filters.rb:606:in `process'
/usr/lib/ruby/1.8/action_controller/base.rb:391:in `process'
/usr/lib/ruby/1.8/action_controller/base.rb:386:in `call'
/usr/lib/ruby/1.8/action_controller/routing/route_set.rb:437:in `call'
/usr/lib/ruby/1.8/action_controller/dispatcher.rb:87:in `dispatch'
/usr/lib/ruby/1.8/action_controller/dispatcher.rb:121:in `_call'
/usr/lib/ruby/1.8/action_controller/dispatcher.rb:130:in `build_middleware_stack'
/usr/lib/ruby/1.8/active_record/query_cache.rb:29:in `call'
/usr/lib/ruby/1.8/active_record/query_cache.rb:29:in `call'
/usr/lib/ruby/1.8/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/usr/lib/ruby/1.8/active_record/query_cache.rb:9:in `cache'
/usr/lib/ruby/1.8/active_record/query_cache.rb:28:in `call'
/usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/usr/lib/ruby/1.8/action_controller/string_coercion.rb:25:in `call'
/usr/lib/ruby/1.8/rack/head.rb:9:in `call'
/usr/lib/ruby/1.8/rack/methodoverride.rb:24:in `call'
/usr/lib/ruby/1.8/action_controller/params_parser.rb:15:in `call'
/usr/lib/ruby/1.8/action_controller/session/cookie_store.rb:93:in `call'
/usr/lib/ruby/1.8/action_controller/failsafe.rb:26:in `call'
/usr/lib/ruby/1.8/rack/lock.rb:11:in `call'
/usr/lib/ruby/1.8/rack/lock.rb:11:in `synchronize'
/usr/lib/ruby/1.8/rack/lock.rb:11:in `call'
/usr/lib/ruby/1.8/action_controller/dispatcher.rb:106:in `call'
/usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in `process_request'
/usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:in `safe_fork'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:in `start'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/phusion_passenger/passenger-spawn-server:61

#5 Updated by Demid Lupin about 8 years ago

I don't found ability to edit own comments so please remove previous

In fresh install of redmine try to create user than go to http://localhost/redmine/users/USER_ID 3 for example and than 500 error

Rails env

About your application's environment
Ruby version 1.8.7 (i486-linux)
RubyGems version 1.3.7
Rack version 1.1
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Edge Rails revision unknown
Application root /usr/share/redmine
Environment production
Database adapter mysql
Database schema version 20100819172912

Mysql

$ mysql --version
mysql Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (i486) using readline 6.1

Redmine

$ dpkg -s redmine
Package: redmine
Status: install ok installed
Architecture: all
Version: 1.0.1-1

StackTrace
ActionView::TemplateError (undefined method `html_safe' for "mail@mail.ru":String) on line #10 of app/views/users/show.rhtml:
7: <div class="splitcontentleft">
8: <ul>
9: <% unless @user.pref.hide_mail >
10: <li><=l(:field_mail)%>: <%= mail_to(h(@user.mail), nil, :encode => 'javascript') ></li>
11: < end >
12: < for custom_value in @custom_values >
13: < if !custom_value.value.blank? %>

/usr/lib/ruby/1.8/action_view/helpers/url_helper.rb:476:in `mail_to'
    app/views/users/show.rhtml:10:in `_run_rhtml_app47views47users47show46rhtml'
    /usr/lib/ruby/1.8/action_view/renderable.rb:34:in `send'
    /usr/lib/ruby/1.8/action_view/renderable.rb:34:in `render'
    /usr/lib/ruby/1.8/action_view/base.rb:306:in `with_template'
    /usr/lib/ruby/1.8/action_view/renderable.rb:30:in `render'
    /usr/lib/ruby/1.8/action_view/template.rb:205:in `render_template'
    /usr/lib/ruby/1.8/action_view/base.rb:265:in `render'
    /usr/lib/ruby/1.8/action_view/base.rb:348:in `_render_with_layout'
    /usr/lib/ruby/1.8/action_view/base.rb:262:in `render'
    /usr/lib/ruby/1.8/action_controller/base.rb:1250:in `render_for_file'
    /usr/lib/ruby/1.8/action_controller/base.rb:987:in `render_without_benchmark'
    /usr/lib/ruby/1.8/action_controller/benchmarking.rb:51:in `render'
    /usr/lib/ruby/1.8/action_controller/benchmarking.rb:51:in `render'
    app/controllers/users_controller.rb:68:in `show'
    /usr/lib/ruby/1.8/action_controller/base.rb:1331:in `send'
    /usr/lib/ruby/1.8/action_controller/base.rb:1331:in `perform_action_without_filters'
    /usr/lib/ruby/1.8/action_controller/filters.rb:617:in `call_filters'
    /usr/lib/ruby/1.8/action_controller/filters.rb:610:in `perform_action_without_benchmark'
    /usr/lib/ruby/1.8/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /usr/lib/ruby/1.8/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /usr/lib/ruby/1.8/action_controller/rescue.rb:160:in `perform_action_without_flash'
    /usr/lib/ruby/1.8/action_controller/flash.rb:146:in `perform_action'
    /usr/lib/ruby/1.8/action_controller/base.rb:532:in `send'
    /usr/lib/ruby/1.8/action_controller/base.rb:532:in `process_without_filters'
    /usr/lib/ruby/1.8/action_controller/filters.rb:606:in `process'
    /usr/lib/ruby/1.8/action_controller/base.rb:391:in `process'
    /usr/lib/ruby/1.8/action_controller/base.rb:386:in `call'
    /usr/lib/ruby/1.8/action_controller/routing/route_set.rb:437:in `call'
    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:87:in `dispatch'
    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:121:in `_call'
    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:130:in `build_middleware_stack'
    /usr/lib/ruby/1.8/active_record/query_cache.rb:29:in `call'
    /usr/lib/ruby/1.8/active_record/query_cache.rb:29:in `call'
    /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
    /usr/lib/ruby/1.8/active_record/query_cache.rb:9:in `cache'
    /usr/lib/ruby/1.8/active_record/query_cache.rb:28:in `call'
    /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
    /usr/lib/ruby/1.8/action_controller/string_coercion.rb:25:in `call'
    /usr/lib/ruby/1.8/rack/head.rb:9:in `call'
    /usr/lib/ruby/1.8/rack/methodoverride.rb:24:in `call'
    /usr/lib/ruby/1.8/action_controller/params_parser.rb:15:in `call'
    /usr/lib/ruby/1.8/action_controller/session/cookie_store.rb:93:in `call'
    /usr/lib/ruby/1.8/action_controller/failsafe.rb:26:in `call'
    /usr/lib/ruby/1.8/rack/lock.rb:11:in `call'
    /usr/lib/ruby/1.8/rack/lock.rb:11:in `synchronize'
    /usr/lib/ruby/1.8/rack/lock.rb:11:in `call'
    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:106:in `call'
    /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in `process_request'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
    /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
    /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:in `safe_fork'
    /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
    /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:in `start'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
    /usr/lib/phusion_passenger/passenger-spawn-server:61

#6 Updated by Petr Pospisil about 8 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

From my side it is resolved by rewrite "html_safe!" to "html_safe". I had it in some plugins that are incompatible with new rails.

#7 Updated by Dan Scharon about 8 years ago

This bug is caused by a regression within the debian package of rails, which was introduced in
the (security) upgrade from 2.3.5-1.2 to 2.3.5-1.2+squeeze0.1

See this entry of the Debian BTS http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629067 for the bug report on rails, which is containing a workaround.

#8 Updated by Etienne Massip about 8 years ago

  • Status changed from Resolved to Closed
  • Resolution set to Invalid

Nice catch, good to know.

#9 Updated by Lawrence Krubner over 6 years ago

Why would I get an error when using the method html_safe?

Installing everything new today, on a Centos server, running Phusion Passenger and Nginx. Ruby 1.8.7. Redmine 2.2

Completed 500 Internal Server Error
ActionView::Template::Error (undefined method html_safe' for nil:NilClass):

Also available in: Atom PDF