I have value in my Coffeescript file (
You can't simply share and access variables from independent scripts that are running separately on the frontend and the backend. If you want to pass a value from the frontend to the backend, you need to use
You can do something like this in
# config/routes.rb post '/run_job', to: 'jobs#run'
and add a controller method which receives the passed value and executes your
my_job.rb with it:
# app/controllers/jobs_controller.rb def run passed_variable = params[:my_var] # now invoke your my_job.rb with the 'passed_variable' end