Module: CastleDevise::Helpers::CastleHelper
- Defined in:
- lib/castle_devise/helpers/castle_helper.rb
Overview
Methods defined here will be available in all your views.
Instance Method Summary collapse
-
#castle_javascript_tag ⇒ Object
Creates a <script> tag that includes our c.js script from a CDN.
-
#castle_on_form_submit ⇒ String
Puts an inline <script> tag that includes a “castle_devise_token” field within the current form.
Instance Method Details
#castle_javascript_tag ⇒ Object
Creates a <script> tag that includes our c.js script from a CDN. You have to make sure that your app_id is valid, otherwise the script won’t work.
You shouldn’t call this method if you bundle our c.js script with your other JS packages.
You should put this in the <head> section of your page:
24 25 26 27 28 |
# File 'lib/castle_devise/helpers/castle_helper.rb', line 24 def castle_javascript_tag javascript_include_tag( "https://cdn.castle.io/v2/castle.js?#{CastleDevise.configuration.app_id}" ) end |
#castle_on_form_submit ⇒ String
Puts an inline <script> tag that includes a “castle_devise_token” field within the current form.
40 41 42 |
# File 'lib/castle_devise/helpers/castle_helper.rb', line 40 def castle_on_form_submit "typeof(_castle)=='undefined'?event.preventDefault():_castle('onFormSubmit', event)" end |