I render a partial in my view like this:
<script>
$(document).ready(function(){
$('#add_shipping_address').click(function(e){
$('#shipping_addresses').append("<%= escape_javascript(render :partial => 'shipping_address' ) %>");
});
});
</script>
The partial renders fine but in my partial I got a random variable
<% random_id = rand(9999999) %>
The strange thing is every time I render the partial via click on that button the random variable is the same, like it gets generated once and then just gets repeated. Is that a normal behaviour and if so, what can I do to avoid this?