lib/stripe_wrapper/engine.rb in stripe_wrapper-0.1.0 vs lib/stripe_wrapper/engine.rb in stripe_wrapper-0.1.1
- old
+ new
@@ -1,5 +1,37 @@
+require 'active_support/dependencies'
+require 'bootstrap-sass'
+require_dependency 'stripe_wrapper/main_app_route_delegator'
+
module StripeWrapper
class Engine < ::Rails::Engine
+ require 'jquery-rails'
isolate_namespace StripeWrapper
+
+ initializer 'stripe_wrapper.action_controller' do |app|
+ ActiveSupport.on_load :action_controller do
+ helper StripeWrapper::StripeWrapperHelper
+ end
+ end
+
+ config.to_prepare do
+ ::StripeWrapper::ApplicationController.helper ::StripeWrapper::MainAppRouteDelegator
+ end
+
+ initializer 'StripeWrapper precompile hook', group: :all do |app|
+ app.config.assets.precompile += %w(
+ stripe_wrapper/stripe_wrapper.js
+ stripe_wrapper/stripe_wrapper.css
+ )
+ end
+
+ initializer "config.stripe" do |app|
+ config.stripe = {
+ :publishable_key => ENV['STRIPE_PUBLIC_KEY'],
+ :secret_key => ENV['STRIPE_KEY']
+ }
+
+ Stripe.api_key = ENV['STRIPE_KEY']
+ end
+
end
end