0
+A slice for the Merb framework.
0
+------------------------------------------------------------------------------
0
+Instructions for installation:
0
+# add the slice as a regular dependency
0
+dependency 'secure-magic'
0
+# if needed, configure which slices to load and in which order
0
+Merb::Plugins.config[:merb_slices] = { :queue => ["SecureMagic", ...] }
0
+# optionally configure the plugins in a before_app_loads callback
0
+Merb::BootLoader.before_app_loads do
0
+ Merb::Slices::config[:secure_magic][:option] = value
0
+# example: /secure-magic/:controller/:action/:id
0
+r.add_slice(:SecureMagic)
0
+# example: /foo/:controller/:action/:id
0
+r.add_slice(:SecureMagic, 'foo') # same as :path => 'foo'
0
+# example: /:lang/:controller/:action/:id (with :a param set)
0
+r.add_slice(:SecureMagic, :path => ':lang', :params => { :a => 'b' })
0
+# example: /:controller/:action/:id
0
+Normally you should also run the following rake task:
0
+rake slices:secure_magic:install
0
+------------------------------------------------------------------------------
0
+You can put your application-level overrides in:
0
+host-app/slices/secure-magic/app - controllers, models, views ...
0
+Templates are located in this order:
0
+1. host-app/slices/secure-magic/app/views/*
0
+2. gems/secure-magic/app/views/*
0
+3. host-app/app/views/*
0
+You can use the host application's layout by configuring the
0
+secure-magic slice in a before_app_loads block:
0
+Merb::Slices.config[:secure_magic] = { :layout => :application }
0
+By default :secure_magic is used. If you need to override
0
+stylesheets or javascripts, just specify your own files in your layout
0
+instead/in addition to the ones supplied (if any) in
0
+host-app/public/slices/secure-magic.
0
+In any case don't edit those files directly as they may be clobbered any time
0
+rake secure_magic:install is run.
0
+------------------------------------------------------------------------------
0
+Merb-Slices is a Merb plugin for using and creating application 'slices' which
0
+help you modularize your application. Usually these are reuseable extractions
0
+from your main app. In effect, a Slice is just like a regular Merb MVC
0
+application, both in functionality as well as in structure.
0
+When you generate a Slice stub structure, a module is setup to serve as a
0
+namespace for your controller, models, helpers etc. This ensures maximum
0
+encapsulation. You could say a Slice is a mixture between a Merb plugin (a
0
+Gem) and a Merb application, reaping the benefits of both.
0
+A host application can 'mount' a Slice inside the router, which means you have
0
+full over control how it integrates. By default a Slice's routes are prefixed
0
+by its name (a router :namespace), but you can easily provide your own prefix
0
+or leave it out, mounting it at the root of your url-schema. You can even
0
+mount a Slice multiple times and give extra parameters to customize an
0
+A Slice's Application controller uses controller_for_slice to setup slice
0
+specific behaviour, which mainly affects cascaded view handling. Additionaly,
0
+this method is available to any kind of controller, so it can be used for
0
+Merb Mailer too for example.
0
+There are many ways which let you customize a Slice's functionality and
0
+appearance without ever touching the Gem-level code itself. It's not only easy
0
+to add template/layout overrides, you can also add/modify controllers, models
0
+and other runtime code from within the host application.
0
+To create your own Slice run this (somewhere outside of your merb app):
0
+$ merb-gen slice <your-lowercase-slice-name>
0
\ No newline at end of file
Comments
No one has commented yet.