Permalink
Browse files

Update version and README

  • Loading branch information...
1 parent 2fc79f5 commit 8e1920915129c72631550ea1a5e5e89af9018b31 @dnagir committed Feb 28, 2013
Showing with 28 additions and 1 deletion.
  1. +27 −0 README.md
  2. +1 −1 lib/allowy/version.rb
View
@@ -103,6 +103,33 @@ class PagesController < ApplicationController
end
```
+
+## Customising access class
+
+The "access" class, by convention, will be determined by the class of the original object plus the "Access" suffix.
+It may be a problem if you decorate the class using `draper` gem or using similar approach where the actual class name is different.
+
+The version `0.3` of has built-in support for the `draper` gem and it should "just work".
+
+But additionally it provides a customisation option for you if you need that.
+
+So if you need to change the access class for your object you need to do the following:
+
+
+```ruby
+# This will just work provided there's a PageAccess class
+class PageDecorator < Draper::Decorator
+end
+
+class PageViewModel < SimpleDelegator
+ # This will allow using PageViewModel as it would be just Page
+ def self.source_class
+ Page
+ end
+end
+
+```
+
## More comprehensive example
You probably have multiple classes that you want to protect.
View
@@ -1,3 +1,3 @@
module Allowy
- VERSION = "0.2.6"
+ VERSION = "0.3.0"
end

0 comments on commit 8e19209

Please sign in to comment.