I am a front end developer and new to Ruby on Rails so please ignore my lack of naming conventions etc.
The site I am working on uses RequireJS and I am implementing Recurly payment form, I can get everything working except the signature.
The problem is that the signature I generated by the server and therefore it needs to pass though Ruby to get the code to build the transaction form, but because the application.js file is not 'erb' then it can't find the value, here is the JS:
Recurly.config({
subdomain: "ie-webinar"
, currency: "USD"
, country: "US"
});
Recurly.buildTransactionForm({
target: '#recurly-transaction'
, successURL: '/thank_you.html'
, signature:'<%= @signature %>'
});
Here is the Ruby code inside config > initialiser > recurly.rb
signature = Recurly.js.sign(
:transaction => { :amount_in_cents => 19_99, :currency => 'USD' }
)
How can I solve this issue? I have experimented with creating a .js.erb file inside the view but I am unsure how to call it or get it to appear in the website header?