Module: BraintreeTransparentRedirectSlice
- Defined in:
- lib/braintree_transparent_redirect_slice.rb,
lib/braintree_transparent_redirect_slice/version.rb
Overview
All Slice code is expected to be namespaced inside a module
Defined Under Namespace
Classes: Application, CreditCards, Main, Payments
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
-
.activate ⇒ Object
Activation hook - runs after AfterAppLoads BootLoader.
- .config ⇒ Object
-
.deactivate ⇒ Object
Deactivation hook - triggered by Merb::Slices.deactivate(BraintreeTransparentRedirectSlice).
-
.init ⇒ Object
Initialization hook - runs before AfterAppLoads BootLoader.
-
.loaded ⇒ Object
Stub classes loaded hook - runs before LoadClasses BootLoader right after a slice’s classes have been loaded internally.
-
.setup_router(scope) ⇒ Object
Setup routes inside the host application.
Class Method Details
.activate ⇒ Object
Activation hook - runs after AfterAppLoads BootLoader
57 58 |
# File 'lib/braintree_transparent_redirect_slice.rb', line 57 def self.activate end |
.config ⇒ Object
42 43 44 |
# File 'lib/braintree_transparent_redirect_slice.rb', line 42 def self.config @config ||= { } end |
.deactivate ⇒ Object
Deactivation hook - triggered by Merb::Slices.deactivate(BraintreeTransparentRedirectSlice)
61 62 |
# File 'lib/braintree_transparent_redirect_slice.rb', line 61 def self.deactivate end |
.init ⇒ Object
Initialization hook - runs before AfterAppLoads BootLoader
47 48 49 50 51 52 53 54 |
# File 'lib/braintree_transparent_redirect_slice.rb', line 47 def self.init bt = YAML.load_file(Merb.root / 'config' / 'braintree.yml') if bt[Merb.env] bt[Merb.env].each do |k,v| config[k.to_sym] = v end end end |
.loaded ⇒ Object
Stub classes loaded hook - runs before LoadClasses BootLoader right after a slice’s classes have been loaded internally.
39 40 |
# File 'lib/braintree_transparent_redirect_slice.rb', line 39 def self.loaded end |
.setup_router(scope) ⇒ Object
prefix your named routes with :braintree_transparent_redirect_slice_ to avoid potential conflicts with global named routes.
Setup routes inside the host application
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/braintree_transparent_redirect_slice.rb', line 73 def self.setup_router(scope) scope.resources :credit_cards, :member => {:edit_response => :get}, :collection => {:new_response => :get} do |cards| cards.resources :payments, :collection => {:new_response => :get} end # example of a named route #scope.match('/index(.:format)').to(:controller => 'main', :action => 'index').name(:index) # the slice is mounted at /braintree_transparent_redirect_slice - note that it comes before default_routes scope.match('/').to(:controller => :credit_cards).name(:braintree_home) # enable slice-level default routes by default # scope.default_routes end |