THIS TUTORIAL IS CURRENTLY OUT OF DATE. Hassox has redone merb-auth and it is even better now. I’ll be updating this tutorial as soon as possible.
===========
===========
===========
===========
(this assumes you’ve already setup merb using this tutorial or something similar)
Install the necessary gems
sudo gem install merb_has_flash
cd ~/sources
git clone git://github.com/hassox/merb-auth.git
cd merb-auth
sudo rake install
Setup init.rb and router.rb
#init.rb
dependencies "merb-more", "merb_helpers", "merb-assets", "dm-timestamps", "dm-validations", "merb-slices", "merb-auth", "merb_has_flash"
...
Merb::BootLoader.before_app_loads do
Merb::Slices::config[:merb_auth][:layout] = :application
end
...
#router.rb
...
Merb::Router.prepare do |r|
# Slices
# ADD THIS FOR MERB-AUTH
r.add_slice(:MerbAuth, :path => "", :default_routes => false)
# RESTful routes
# r.resources :posts
# This is the default route for /:controller/:action/:id
# This is fine for most cases. If you're heavily using resource-based
# routes, you may want to comment/remove this line to prevent
# clients from calling your create or destroy actions with a GET
r.default_routes
# Change this for your home page to be available at /
# r.match('/').to(:controller => 'whatever', :action =>'index')
end
4 Responses | September 16, 2008