Writing Plugins

Apparently, the Merb-way is to use Merb.push_path(:lib, '/Users/simmel/code/merb_is_mobile/lib/') and automagic loading but I never could get this to work, so I’m using the Gem-way which works, but is inconvenient since you have to stop and start your server every time you make a change (since your plugin is required in init.rb, it never reloads and when I tried to put the require in my application-code it blows up because I use alias_method).

The Gem-way is to do modify the load-path and just require it:
$:.unshift('/Users/simmel/code/merb_is_mobile/lib/')
require 'merb_is_mobile'

Remember that you have to restart your server every time you add code to your plugin.

Happy coding!

Edit Page | History | Version: