Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Documentation

  • Loading branch information...
commit 08584b353750df670ae7e9e870a14275bcd8e90a 1 parent f6883a6
@11factory authored
Showing with 50 additions and 11 deletions.
  1. +1 −1  MIT-LICENSE
  2. +44 −2 README.rdoc
  3. +5 −8 activeadmin-cancan.gemspec
View
2  MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright 2012 YOURNAME
+Copyright 2012 Laurent Cobos - 11Factory
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
46 README.rdoc
@@ -1,3 +1,45 @@
-= ActiveadminCancan
+= ActiveAdmin-Cancan
-This project rocks and uses MIT-LICENSE.
+ActiveAdmin-Cancan provides a smooth integration of the two gems ActiveAdmin[https://github.com/gregbell/active_admin] and Cancan[https://raw.github.com/ryanb/cancan].
+
+{<img src="https://secure.travis-ci.org/11factory/activeadmin-cancan.png" />}[http://travis-ci.org/11factory/activeadmin-cancan]
+
+== Getting Started
+
+Active Admin - Cancan is released as a Ruby Gem. The gem is to be installed within a Ruby
+on Rails 3 application. To install, simply add the following to your Gemfile:
+
+ gem 'activeadmin-cancan'
+
+== Configure CanCan
+
+You just have two things todo
+
+=== 1. Create the CanCan ability class
+
+User permissions are defined in an +Ability+ class. CanCan includes a Rails 3 generator for creating this class.
+
+ rails g cancan:ability
+
+See CanCan page [https://github.com/ryanb/cancan/wiki/defining-abilities] for details.
+
+=== 2. Handle Unauthorized Access
+
+If the user authorization fails, a <tt>CanCan::AccessDenied</tt> exception will be raised. You can catch this and modify its behavior in the +ApplicationController+.
+
+ class ApplicationController < ActionController::Base
+ rescue_from CanCan::AccessDenied do |exception|
+ redirect_to root_url, :alert => exception.message
+ end
+ end
+
+See CanCan page [https://github.com/ryanb/cancan/wiki/exception-handling] for more information.
+
+=== How it works
+
+I have just made the integration between the two gems, the two steps above are the only ones todo to get roles working with ActiveAdmin.
+
+
+== Copyright
+
+Copyright (c) 2012 Laurent Cobos, 11Factory. See LICENSE for details.
View
13 activeadmin-cancan.gemspec
@@ -1,17 +1,16 @@
$:.push File.expand_path("../lib", __FILE__)
-# Maintain your gem's version:
require "activeadmin-cancan/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "activeadmin-cancan"
s.version = ActiveadminCancan::VERSION
- s.authors = ["TODO: Your name"]
- s.email = ["TODO: Your email"]
- s.homepage = "TODO"
- s.summary = "TODO: Summary of ActiveadminCancan."
- s.description = "TODO: Description of ActiveadminCancan."
+ s.authors = ["Laurent Cobos"]
+ s.email = ["laurent@11factory.fr"]
+ s.homepage = "https://github.com/11factory"
+ s.summary = "Provides CanCan roles to ActiveAdmin"
+ s.description = "Provides CanCan roles to ActiveAdmin"
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
@@ -19,6 +18,4 @@ Gem::Specification.new do |s|
s.add_dependency "rails", ">= 3.0"
s.add_dependency "cancan", ">= 1.6.2"
s.add_dependency "activeadmin", ">= 0.4.0"
-
- s.add_development_dependency "sqlite3"
end
Please sign in to comment.
Something went wrong with that request. Please try again.