Muck Users
Installation
The muck users engine is part of the muck framework and relies upon the muck_engine as well as authlogic. Both gems should be installed automatically when you install the muck_users engine.
sudo gem install muck-users
Use search logic for searching users. Add this to environment.rb:
config.gem "binarylogic-searchlogic",
:lib => 'searchlogic',
:source => 'http://gems.github.com',
:version => '~> 2.0.0'
In addition, you will need to install the ssl_requirement plugin (github.com/rails/ssl_requirement/tree/master) into your Rails project:
ruby script/plugin install ssl_requirement
If you used the muck template to create your rails application you will have a global_config.yml file. If not then you will need to create a global_config.yml file and then add the following to environment.rb right above Rails::Initializer.run do |config|
require 'ostruct'
require 'yaml'
::GlobalConfig = OpenStruct.new(YAML.load_file("#{RAILS_ROOT}/config/global_config.yml")[RAILS_ENV])
Inside of global_config.yml add the following changing the emails to match your application:
default: &DEFAULT
# Sent in emails to users
application_name: 'Name of my application'
from_email: '[email protected]'
support_email: '[email protected]'
admin_email: '[email protected]'
Usage
Be sure to add this route to your routes.rb file:
map.public_user_path '/profiles/:id', :controller => 'profiles', :action => 'show'
This is the path that a user will be redirected to if they attempt to access another user’s dashboard page.
General information
This engine implements authlogic. Some of the code contained was taken from here: railsforum.com/viewtopic.php?id=14216 and here github.com/activefx/restful_authentication_tutorial/tree/master
Inspiration also came from: github.com/tsechingho/authlogic_bundle/tree/master
Example
After installing the engine just create a user model thus:
class User < ActiveRecord::Base
acts_as_authentic
acts_as_muck_user
end
Then you will be able to go to: http//:localhost:3000/login http//:localhost:3000/signup
Copyright © 2009 Justin Ball, released under the MIT license