views:

121

answers:

1

I'm using vhochstein's fork of active_scaffold, which runs quite nicely on rails 3, except for a few small bugs - http://github.com/vhochstein/active_scaffold.

In rails 2.3, the following code disables a link:

return "<a class='disabled'>#{text}</a>" unless authorized

But in Rails 3, it causes the escaped html tags to be printed out instead as in the following photo:

http://internet-websites.s3.amazonaws.com/image2886.png

How can I make the content of this return statement render the way it should in rails 3?

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

UPDATE:

Floatless fixed this by suggesting to add .html_safe to the code.

I have since found that the folowing change also needs to be made as there's more than one bit of code that is respondible for disabling action 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"

i.e. 

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

Anyway, thanks to floatless and hopefully mr hochstein will be able to use this stuff.

+2  A: 

Try this:

return "<a class='disabled'>#{text}</a>".html_safe unless authorized
floatless
awesome! you fixed it. I've emailed the gitrepo owner to let him know about the thread so he can incorporate it into his code. thanks a lot
stephenmurdoch
I forked active_scaffold and added the fixes http://github.com/murdoch/active_scaffold
stephenmurdoch