After the quick merb overview presentation, we then merb'd up a 'hello world', using DataMapper, Erubis and for fun a little HAML.
Some merb bullet points from the presentation:
- Speed
- Favors speed over magic.
- Lightweight
- small, concise code base - no code is the fastest code
- prefer plugins (gems) over bloated core
- Powerful
- multi-threaded
- very extensible (orm, template engine, test framework, javascript framework, etc.)
- ORM Agnostic
- Ships with support for Active Record, Data Mapper, Sequel, but really any ORM can be used.
- Template Agnostic
- Ships with support for Erubius, Markaby, Haml, etc
- JavaScript Library Agnostic
- Feel free to use Jquery, Prototype/ Scriptaculous, MooTools, etc.
- merb uses a slick require_js/include_required_js combination
- Test agnostict
- Rspec, Test::Unit, test/spec etc.
- Targeted Generators
- You tell Merb what ORM, and Testing, you are using and the generators build the respective code
- Provides API (instead of Rails responds_to)
- provides :xml, :js, :yaml
- Custom HTTP Exceptions
- All the standard http error codes can be raised and then handled with controller/view patterns using an exceptions controller as a starting point. So, you can raise NotFound, BadRequest, NotAcceptable, etc
- Parameterized Actions
- You can define the params you want to grab out of the params collection in your method signature: def note_edit(title, body) will grab params[:title], params[:body]
- This allows you treat your controller methods more like real methods with overloads.
- For example: if you define:
- def foo(param1, param2) ...end
- def foo(param1)...end
- Then some_url/foo/1?param2='foo' maps def foo(param1, param2)
- and, some_url/foo/1 maps def foo(param1)
- You can define the params you want to grab out of the params collection in your method signature: def note_edit(title, body) will grab params[:title], params[:body]
- Uses standard ruby “gems” for plugins.
- Your plugins (i.e. gems) can be installed in a application specific /gems folder or as standard “gem install”
- Parts (which are like reusable components) can define their own layout, views and controller
No comments:
Post a Comment