Currently, I have implemented angular's ng-repeat
in a Ruby .erb view.
I now need to create a link_to a page that is dedicated to a specific IP address.
Initially, I attempted:
<td><%= link_to '{{ roll.system }}' ,'server/'+'{{ roll.system }}' %></a></td>
,
where the {{roll.system}}
represents the IP stored in an angular.js variable.
The overall path would be localhost/server/127.0.0.1
but unfortunately, it doesn't work due to the dots in the IP address. So, my next approach is to turn the IP address into a hash and then decode it after routing.
My current code snippet is as follows:
<td><%= link_to '{{ roll.system }}' ,"server/"+Base64.urlsafe_encode64('{{ roll.system }} %></a></td>
The issue here is that Base64 encodes the string literally, resulting in a hash of the exact string '{{ roll.system }}'
. What I actually need is for it to reference the value stored in the angular variable.
Though the link_to function seems to be working fine, I am struggling with this specific problem.
I kindly ask not to provide advice such as 'rewrite your app from scratch'.