<commit_before># Existential
Fine grained authorization can't get any simpler than this.

## Example
    # specify the thoughtful class
    class User < ActiveRecord::Base
      is_existential
    end

    # allow_(action)_for? methods will get the user passed in
    class Post < ActiveRecord::Base
      def allows_edit_for?(user)
        if self.user_id == user.id
          true
        else
          false
        end
      end
    end

    # your thoughtful class will have a can? method that works like so
    class PostController < ActionController::Base
      def edit
        @post = Post.find(params[:id)
       	if current_user.can?(:edit, @post)
          # render the view          
        else
          # raise an exception, yell at the user, whatever
        end
      end
    end    

## Thanks

Thanks to <NAME> for his excellent post on this pattern, which inspired this plugin

http://pivotallabs.com/users/nick/blog/articles/272-access-control-permissions-in-rails


## License

Copyright (c) 2010 <NAME>, released under the MIT license<commit_msg>more readme<commit_after># Existential
Fine grained authorization can't get any simpler than this.

## Example
    # specify the thoughtful class
    class User < ActiveRecord::Base
      is_existential
    end

    # allow_(action)_for? methods will get the user passed in
    class Post < ActiveRecord::Base
      def allows_edit_for?(user)
        if self.user_id == user.id
          true
        else
          false
        end
      end
    end

    # your thoughtful class will have a can? method that works like so
    class PostController < ActionController::Base
      def edit
        @post = Post.find(params[:id)
       	if current_user.can?(:edit, @post)
          # render the view          
        else
          # raise an exception, yell at the user, whatever
        end
      end
    end    

## Thanks

Thanks to <NAME> for his excellent post on this pattern, which inspired this plugin

[http://pivotallabs.com/users/nick/blog/articles/272-access-control-permissions-in-rails]


## License

Copyright (c) 2010 <NAME>, released under the MIT license
{'fraction_non_alphanumeric': 0.0708955223880597, 'fraction_numerical': 0.0065298507462686565, 'mean_word_length': 2.330745341614907, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7100015', 'n_tokens_mistral': 609, 'n_tokens_neox': 576, 'n_words': 212}