M
M
Max2016-04-23 16:10:27
Ruby on Rails
Max, 2016-04-23 16:10:27

How to access an image from application.js (Rails)?

Hello, there is such code in application.js

$(function() {
      $('.datepicker').datepicker({
        dateFormat: 'yy-mm-dd',
          showOn: "button",
          buttonImage: 'app/assets/images/calendar.png',
          buttonImageOnly: true,
          buttonText: "Select date"
      });
    });

I want to attach an image that is in the assets/images folder. I tried a bunch of options from google, but the wrong path is constantly indicated. Please tell me how to get to the image.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CorbenDallass, 2016-04-26
@maxprof

Rename the file to apllication.js.erb and use
guides.rubyonrails.org/asset_pipeline.html#javascr...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question