Ruby-on-rails – Rails 3 prints the HTML tag to the screen instead of rendering them

I am using the active_scaffold branch of vhochstein, and it runs very well on rails 3, except for some minor errors – http://github.com/vhochstein/active_scaffold.

< /p>

In rails 2.3, the following code disables links:

return "#{text}" unless authorized

But in Rails 3, it will cause the exported html tags to be printed, as shown in the following figure:

How to make the content of this return statement show that it is in rails 3 How is it applied in?

The above code comes from the list_column_helpers.rb file in vendor/plugins/active_scaffold/helpers/

Update:

Add .html_safe to the code through suggestions , Floatless fixes this problem.

I have found that the following changes are also needed, because there are multiple codes that can respond to disabling operation links in active_Scaffold:

In /plugins/active_scaffold/frontends /default/views/_list_actions.html.erb change:

<%= record.authorized_for?(:crud_type => etc etc etc -%>

By making it use "raw"

ie

<%= raw record.authorized_for?(:crud_type => etc etc etc -%>

< p>Anyway, thanks to float, I hope Mr. Hochstein can use these things.

try this :

return "#{text}".html_safe unless authorized

< /p>

I am using vhochstein’s active_scaffold branch, and it works very well on rails 3, except for some minor errors-http://github.com/vhochstein/active_scaffold.

In rails 2.3, the following code disables links:

return "#{text}" unless authorized

But in Rails 3, it will cause the exported html tags to be printed, as shown below:

How to make this return statement The content shows how it is applied in rails 3?

The above code comes from the list_column_helpers.rb file in vendor/plugins/active_scaffold/helpers/

Update:

Add .html_safe to the code through suggestions , Floatless fixes this problem.

I have found that the following changes are also needed, because there are multiple codes that can respond to disabling operation links in active_Scaffold:

In /plugins/active_scaffold/frontends /default/views/_list_actions.html.erb change:

<%= record.authorized_for?(:crud_type => etc etc etc -%>

By making it use "raw"

ie

<%= raw record.authorized_for?(:crud_type => etc etc etc -%>

< p>Anyway, thanks to Floating, I hope Mr. Hochstein can use these things.

Try this:

< /p>

return "#{text}".html_safe unless authorized

Leave a Comment

Your email address will not be published.