I’ve just written a little code template generator for Merb called Stage. This idea was originally implemented as a plugin for Rails, but has been refactored as a gem. This new version is for Merb + DataMapper only. Extended support for Rails and other ORMs are planned.
There appears to be some quirk [...]
Archive for the ‘Merb’ Category
Merb Assets updated
Posted in Merb on April 16, 2008 | Comments Off
The merb-assets post has been updated with information on css and javascript helpers.
Merb Helpers
Posted in Merb on April 16, 2008 | Comments Off
$ sudo gem install merb_helpers
This will get you the merb_helpers gem. This handy gem has the helpers I found really useful in Rails. Methods such as form_for, error_messages_for and the like are included in this gem.
Not all the methods are exactly the same as the Rails helpers. Take a look at the [...]
Merb Assets – clarified
Posted in Merb on April 16, 2008 | Comments Off
So, I had some confusion at the start between assets and helpers. While merb-assets provides the link_to method, it’s not the same as what I would consider “helpers”. Assets are, well, asset oriented. By this I mean images, javascripts and stylesheets. Please refer to the merb-more documentation for assets to get a [...]
Merb Routing update
Posted in Merb on April 11, 2008 | Comments Off
I’ve updated the Merb Routing post with information on how to use your defined resources with link_to.
Merb boot order
Posted in Merb on April 11, 2008 | Comments Off
So, for the better part of a day, I’ve been really focused on the load sequence of Merb to understand the order in which the resources are loaded. Here’s a summary of my understanding of the bootloader code.
The BootLoader class has a clean design for defining the initialization sequence, it just took me a [...]
Merb Sessions
Posted in DataMapper, Merb on April 10, 2008 | Comments Off
By default, Merb uses a cookie session store. Straight from the Merb docs:
If you have more than 4K of session data or don’t want your data to be visible to the user, pick another session store.
I have more than 4k and I don’t want the data visible (most important aspect). So, since I’m [...]
Initializers in Merb
Posted in Merb on April 8, 2008 | Comments Off
Note: A lot has been learned since I posted this. Please read the boot order post for more detailed information.
I was a fan of the config/initializers directory functionality recently added into Rails. I want it in Merb. So, to get this add the following into the Merb::BootLoader.before_app_loads block in config/init.rb.
Merb::BootLoader.before_app_loads do [...]
Merb Logging
Posted in Merb on April 7, 2008 | Comments Off
To call the Merb logger:
Merb.logger.info(“Here is some information…”)
back to Merb index
Merb Routing
Posted in Merb on April 7, 2008 | 1 Comment »
Routing is very similar to Rails:
In your config/router.rb define your routes as such:
Merb::Router.prepare do |r| r.resources :pages r.resources :contents r.resources :folders r.resources :functions r.resources :messages
#Allows me to call link_to(‘Home’, :home) r.resource :home, {:controller => ‘home’, :action => ‘index’}end
Update 2008.04.11:The Rails way adds a bunch of methods for you after defining a resource (like I [...]
