Currently, I am developing a Rails application where one page utilizes Vue.js to load a Google map, make some API calls with Axios, and gather user values using Vue.js. My goal is to pass these values as parameters within a "link_to" erb tag. Please refer to the code snippet below for reference:
Here is the hardcoded data in my Vue instance.
let vm = new Vue({
el: '#vue-map',
data: {
selectedProductId: 46,
latt: '-26.29217',
long: '28.070820000000026'
}
Below is an excerpt from the actual index.html.erb file.
<div class='panel-footer'>
<%= link_to 'Continue',maps_path(:product => {{selectedProductId}}) ,class: "btn btn-success"%>
</div>
Upon implementing this code, I encountered the error message "syntax error, unexpected '}'."
I attempted both with and without quotes. Without quotes, I received the syntax error mentioned earlier, and with quotes, it passed but the parameter in my Rails controller was treated as a string instead of the value stored in the Vue data.
If you have any insights or solutions, I would greatly appreciate your assistance :)