This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ability | |
include CanCan::Ability | |
def marshal_dump | |
#blocks cannot be cached | |
@rules.reject{|rule| rule.instance_variable_get :@block }.map{|rule| Marshal.dump(rule) } | |
end | |
def marshal_load array | |
#blocks cannot be cached, so blocks must be re-defined | |
can :read, Comment do |comment| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Account | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
field :subdomain, :type => String | |
embeds_many :users | |
accepts_nested_attributes_for :users | |
validates_presence_of :name, :subdomain | |
validates_uniqueness_of :subdomain, :case_sensitive => false |