[Solved] How to replace a pattern in a string


I would do this for the links

<%= ([1,2,3]- [params[:x]]).each do |link_number| %>
   <%= link_to "Version #{link_number}", "/page?x=#{link_number}" %>
<% end %>

This way everytime the page is loaded the link to the other 2 versions will exist.

You could handle the partials through the controller (which seems better) or use something like:

<%= render "version_#{['A','B','C'][params[:x] - 1]}" %>

Without a better understanding of the problem I cannot assist beyond this point.

solved How to replace a pattern in a string