I have an array @fields which has text and an id, asset_id. To pass local variables from controller to view in render we use
render(:template => "assets/invalid", :locals => {:asset_id => params[:id], :fields => @fields})
The view is
<div id="panel">
<script>
alert('Invalid values for ')
window.location = "../assets/"
</script>
</div>
This should generate a popup box. However, I want the popup box to redirect to "../assets/asset_id" and also display 'Invalid values for + fields'
The following doesn't work,
<div id="panel">
<script>
var fields = fields
var asset_id = asset_id
alert('Invalid values for ' + fields )
window.location = "../assets/" + asset_id
</script>
</div>