I have the following code:
/assets/javascripts/home.js.coffee.erb
jQuery ->
addClickListeners = ->
$(document).on 'click', '#add-chord-link', addChord
$(document).on 'click', '#remove-chord-link', removeChord
addChord = (e) ->
e.preventDefault()
console.log("<%= asset_path('rails.png') %>")
console.log("<%= link_to 'Sign up now!', '#' %>")
console.log('addChord clicked')
$('#chord-choices').append('addedChord')
removeChord = (e) ->
e.preventDefault()
$('#chord-choices select').last().remove()
console.log('removeChord clicked')
addClickListeners()
The console output for the console.log("<%= asset_path('rails.png') %>")
is /assets/rails.png
, which is what I expect. However, whenever I include console.log("<%= link_to 'Sign up now!', '#' %>")
I get an error when the page is loaded stating:
undefined method `link_to' for #<#<Class:0x007f9095960938>:0x007f9095b78ab8>
Why is this not working?