Ask Your Question

Deprecated variable references in tempates

asked 2014-08-20 11:39:44 -0500

RobertII gravatar image

updated 2014-08-20 12:01:56 -0500

Since this question has gone alarmingly unanswered, I'd like to say "me too", and also add a follow-up question:

Never mind finding the deprecated references, is there no way to automatically fix them?

If not, why not?

Removing a feature is likely to force many users to make many changes to working code -- I have something over 100 templates to worry about, some with over a dozen variable accesses. At least for someone who is not familiar with Ruby, it is not straightforward: a bulk replace of "<%= ([a-z]*" with "<%= @\1" catches a lot of them, but it seems to be over-general -- for instance, it wrecked

<% dev_ips.each do |ip| %>
    Allow from <%= ip %>
<% end %>

by adding an "@" to the inclusion of "ip".

So am I really going to have to go through them one by one?

Has anybody written anything to help?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-08-26 13:31:43 -0500

WhatsARanjit gravatar image

It's hard to write a script to prefix all your variables with an @, not knowing what your variables are in the first place. For example, a script might change ip to @ip, but then why not do to @do. So you'd either have to generate a black-list of reserved Ruby words (and plain-text words: horrible!) or generate a white-list of all your variable names. Take a look at this gist and see if it helps.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-08-20 11:39:44 -0500

Seen: 33 times

Last updated: Aug 26 '14