mercredi 19 octobre 2016

Rails confuses loading of assets by js for actual route and processes it as controller action

I'm trying to implement ion.sound in Rails 3.22 I can't get to have the sounds to be processed. I parametered ion.sound to fetch the sound assets in "/app/assets", in my js.coffee file like this :

# initialise plugin for ion sound
$ -> $.ionSound
    sounds: [
       { name: 'metal_plate' }
    ]
    path: '/app/assets/'
    preload: true
    multiplay: true
    volume: 0.5
# play sound
$ -> $.ionSound.play 'metal_plate'

but I noticed that the server trace indicates that it is conducting GETs on the sound paths and that Rails processes theses assets paths as controller actions, attempting to execute the corresponding actions which don't exist. Here is an exemple from the trace:

Started GET "/app/assets/metal_plate.aac?1476881187282" for 127.0.0.1 at 2016-10-19 14:46:27 +0200 Processing by DimensionsController#show as Parameters: {"1476881187282"=>nil, "client_id"=>"app", "produit_id"=>"assets", "id"=>"metal_plate"} Redirected to http://ift.tt/2ehZknD Filter chain halted as :signed_in_client rendered or redirected

so the result is a useless redirection and the sound asset isn't processed by ion.sound... What a mess !

Aucun commentaire:

Enregistrer un commentaire