I am implemented Recurly payments into a project, the project is using requirejs and there are requirejs 2 javascript files, 1 named 'front.js.coffee' for customer facing site and the second named 'admin.js.coffee' for the CMS. I have created a global variable as a partial that I render into the website header and then I need the front.js file to pull this value in order to build the Recurly transaction form. I had to do it this way because I need the server to generate a signature so therefore this had to pass through a '*html.erb' file.
So here is the global variable inside a shared view file:
<%= javascript_tag do %>
signature_value: '<%= j RECURLY_SIGNATURE %>'
<% end %>
So here is the JS inside the front.js file:
Recurly.config
subdomain: 'iewebinar'
currency: 'USD'
country: 'US'
Recurly.buildTransactionForm
target: '#recurly-transaction'
successURL: '/webinars/thank_you.html'
signature: 'signature_value'
I am new to Ruby on Rails development and I dont entirely understand Requirejs so simple instructions would be great :)