cancancan 1.15.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/cancancan.gemspec +18 -18
- data/init.rb +2 -0
- data/lib/cancan.rb +9 -11
- data/lib/cancan/ability.rb +90 -203
- data/lib/cancan/ability/actions.rb +93 -0
- data/lib/cancan/ability/rules.rb +93 -0
- data/lib/cancan/ability/strong_parameter_support.rb +41 -0
- data/lib/cancan/conditions_matcher.rb +106 -0
- data/lib/cancan/controller_additions.rb +29 -36
- data/lib/cancan/controller_resource.rb +46 -211
- data/lib/cancan/controller_resource_builder.rb +26 -0
- data/lib/cancan/controller_resource_finder.rb +42 -0
- data/lib/cancan/controller_resource_loader.rb +120 -0
- data/lib/cancan/controller_resource_name_finder.rb +23 -0
- data/lib/cancan/controller_resource_sanitizer.rb +32 -0
- data/lib/cancan/exceptions.rb +17 -5
- data/lib/cancan/matchers.rb +12 -3
- data/lib/cancan/model_adapters/abstract_adapter.rb +10 -8
- data/lib/cancan/model_adapters/active_record_4_adapter.rb +39 -43
- data/lib/cancan/model_adapters/active_record_5_adapter.rb +68 -0
- data/lib/cancan/model_adapters/active_record_adapter.rb +77 -82
- data/lib/cancan/model_adapters/conditions_extractor.rb +75 -0
- data/lib/cancan/model_adapters/conditions_normalizer.rb +49 -0
- data/lib/cancan/model_adapters/default_adapter.rb +2 -0
- data/lib/cancan/model_additions.rb +2 -1
- data/lib/cancan/parameter_validators.rb +9 -0
- data/lib/cancan/relevant.rb +29 -0
- data/lib/cancan/rule.rb +76 -106
- data/lib/cancan/rules_compressor.rb +23 -0
- data/lib/cancan/unauthorized_message_resolver.rb +24 -0
- data/lib/cancan/version.rb +3 -1
- data/lib/cancancan.rb +2 -0
- data/lib/generators/cancan/ability/ability_generator.rb +4 -2
- data/lib/generators/cancan/ability/templates/ability.rb +2 -0
- metadata +66 -57
- data/.gitignore +0 -15
- data/.rspec +0 -1
- data/.travis.yml +0 -33
- data/Appraisals +0 -104
- data/CHANGELOG.rdoc +0 -527
- data/CONTRIBUTING.md +0 -23
- data/Gemfile +0 -3
- data/LICENSE +0 -22
- data/README.md +0 -217
- data/Rakefile +0 -9
- data/gemfiles/activerecord_3.2.gemfile +0 -17
- data/gemfiles/activerecord_4.0.gemfile +0 -18
- data/gemfiles/activerecord_4.1.gemfile +0 -18
- data/gemfiles/activerecord_4.2.gemfile +0 -19
- data/gemfiles/activerecord_5.0.gemfile +0 -19
- data/gemfiles/mongoid_2.x.gemfile +0 -17
- data/gemfiles/sequel_3.x.gemfile +0 -17
- data/lib/cancan/inherited_resource.rb +0 -20
- data/lib/cancan/model_adapters/active_record_3_adapter.rb +0 -16
- data/lib/cancan/model_adapters/mongoid_adapter.rb +0 -75
- data/lib/cancan/model_adapters/sequel_adapter.rb +0 -87
- data/spec/README.rdoc +0 -27
- data/spec/cancan/ability_spec.rb +0 -544
- data/spec/cancan/controller_additions_spec.rb +0 -151
- data/spec/cancan/controller_resource_spec.rb +0 -643
- data/spec/cancan/exceptions_spec.rb +0 -58
- data/spec/cancan/inherited_resource_spec.rb +0 -71
- data/spec/cancan/matchers_spec.rb +0 -29
- data/spec/cancan/model_adapters/active_record_4_adapter_spec.rb +0 -154
- data/spec/cancan/model_adapters/active_record_adapter_spec.rb +0 -405
- data/spec/cancan/model_adapters/default_adapter_spec.rb +0 -7
- data/spec/cancan/model_adapters/mongoid_adapter_spec.rb +0 -247
- data/spec/cancan/model_adapters/sequel_adapter_spec.rb +0 -132
- data/spec/cancan/rule_spec.rb +0 -52
- data/spec/matchers.rb +0 -13
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -27
- data/spec/support/ability.rb +0 -7
data/CONTRIBUTING.md
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
## Contributing to CanCanCan
|
2
|
-
|
3
|
-
### Reporting an Issue
|
4
|
-
|
5
|
-
1. If you have any questions about CanCanCan, search the [Wiki](https://github.com/cancancommunity/cancancan/wiki), use [Stack Overflow](http://stackoverflow.com/questions/tagged/cancancan), or [our mailing list](https://groups.google.com/forum/#!forum/cancancan). Do not post questions here.
|
6
|
-
|
7
|
-
1. If you find a security bug, **DO NOT** submit an issue here. Please send an e-mail to the current maintainer instead.
|
8
|
-
|
9
|
-
1. Do a small search on the issues tracker before submitting your issue to see if it was already reported / fixed.
|
10
|
-
|
11
|
-
1. Create your report including Rails and CanCanCan versions. If you are getting exceptions, please include the full backtrace.
|
12
|
-
|
13
|
-
That's it! The more information you give, the more easy it becomes for us to track it down and fix it. Ideal scenario would be adding the issue to CanCanCan test suite or to a sample application.
|
14
|
-
|
15
|
-
### Adding new Features or Bugfixes
|
16
|
-
|
17
|
-
CanCanCan uses a [git-flow](http://nvie.com/posts/a-successful-git-branching-model/) development model. The latest "released" version of CanCanCan, the latest gem version, can always be found on `master`, while the next version or nightly is on `develop`.
|
18
|
-
|
19
|
-
Please make sure you have test coverage for anything you add or fix!
|
20
|
-
|
21
|
-
Please add a CHANGELOG entry with any relevant tags for issues, pull-requests, and authors.
|
22
|
-
|
23
|
-
Thanks!
|
data/Gemfile
DELETED
data/LICENSE
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2011 Ryan Bates
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,217 +0,0 @@
|
|
1
|
-
# CanCanCan
|
2
|
-
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/cancancan.svg)](http://badge.fury.io/rb/cancancan)
|
4
|
-
[![Travis badge](https://travis-ci.org/CanCanCommunity/cancancan.svg?branch=develop)](https://travis-ci.org/CanCanCommunity/cancancan)
|
5
|
-
[![Code Climate Badge](https://codeclimate.com/github/CanCanCommunity/cancancan.svg)](https://codeclimate.com/github/CanCanCommunity/cancancan)
|
6
|
-
[![Inch CI](http://inch-ci.org/github/CanCanCommunity/cancancan.svg)](http://inch-ci.org/github/CanCanCommunity/cancancan)
|
7
|
-
|
8
|
-
[Wiki](https://github.com/CanCanCommunity/cancancan/wiki) | [RDocs](http://rdoc.info/projects/CanCanCommunity/cancancan) | [Screencast](http://railscasts.com/episodes/192-authorization-with-cancan) | [IRC: #cancancan (freenode)](http://webchat.freenode.net/?channels=cancancan)
|
9
|
-
|
10
|
-
CanCan is an authorization library for Ruby on Rails which restricts what resources a given user is allowed to access. All permissions are defined in a single location (the `Ability` class) and not duplicated across controllers, views, and database queries.
|
11
|
-
|
12
|
-
## This is the master branch!
|
13
|
-
This branch represents work towards version 2.0. Please checkout the 1.x branch for the stable release. Use master at your own risk.
|
14
|
-
|
15
|
-
## Mission
|
16
|
-
|
17
|
-
This repo is a continuation of the dead [CanCan](https://github.com/ryanb/cancan) project. Our mission is to keep CanCan alive and moving forward, with maintenance fixes and new features. Pull Requests are welcome!
|
18
|
-
|
19
|
-
I am currently focusing on the 1.x branch for the immediate future, making sure it is up to date as well as ensuring compatibility with Rails 4+. I will take a look into the 2.x branch and try to see what improvements, reorganizations and redesigns Ryan was attempting and go forward from there.
|
20
|
-
|
21
|
-
Any help is greatly appreciated, feel free to submit pull-requests or open issues.
|
22
|
-
|
23
|
-
|
24
|
-
## Installation
|
25
|
-
|
26
|
-
In **Rails 3 and 4**, add this to your Gemfile and run the `bundle install` command.
|
27
|
-
|
28
|
-
gem 'cancancan', '~> 1.10'
|
29
|
-
|
30
|
-
## Getting Started
|
31
|
-
|
32
|
-
CanCanCan expects a `current_user` method to exist in the controller. First, set up some authentication (such as [Authlogic](https://github.com/binarylogic/authlogic) or [Devise](https://github.com/plataformatec/devise)). See [Changing Defaults](https://github.com/CanCanCommunity/cancancan/wiki/changing-defaults) if you need different behavior.
|
33
|
-
|
34
|
-
When using [rails-api](https://github.com/rails-api/rails-api), you have to manually include the controller methods for CanCan:
|
35
|
-
```ruby
|
36
|
-
class ApplicationController < ActionController::API
|
37
|
-
include CanCan::ControllerAdditions
|
38
|
-
end
|
39
|
-
```
|
40
|
-
|
41
|
-
### 1. Define Abilities
|
42
|
-
|
43
|
-
User permissions are defined in an `Ability` class. CanCan 1.5 includes a Rails 3 and 4 generator for creating this class.
|
44
|
-
|
45
|
-
rails g cancan:ability
|
46
|
-
|
47
|
-
In Rails 2.3, just add a new class in `app/models/ability.rb` with the following contents:
|
48
|
-
|
49
|
-
```ruby
|
50
|
-
class Ability
|
51
|
-
include CanCan::Ability
|
52
|
-
|
53
|
-
def initialize(user)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
```
|
57
|
-
|
58
|
-
See [Defining Abilities](https://github.com/CanCanCommunity/cancancan/wiki/defining-abilities) for details.
|
59
|
-
|
60
|
-
|
61
|
-
### 2. Check Abilities & Authorization
|
62
|
-
|
63
|
-
The current user's permissions can then be checked using the `can?` and `cannot?` methods in the view and controller.
|
64
|
-
|
65
|
-
```erb
|
66
|
-
<% if can? :update, @article %>
|
67
|
-
<%= link_to "Edit", edit_article_path(@article) %>
|
68
|
-
<% end %>
|
69
|
-
```
|
70
|
-
|
71
|
-
See [Checking Abilities](https://github.com/CanCanCommunity/cancancan/wiki/checking-abilities) for more information
|
72
|
-
|
73
|
-
The `authorize!` method in the controller will raise an exception if the user is not able to perform the given action.
|
74
|
-
|
75
|
-
```ruby
|
76
|
-
def show
|
77
|
-
@article = Article.find(params[:id])
|
78
|
-
authorize! :read, @article
|
79
|
-
end
|
80
|
-
```
|
81
|
-
|
82
|
-
Setting this for every action can be tedious, therefore the `load_and_authorize_resource` method is provided to automatically authorize all actions in a RESTful style resource controller. It will use a before filter to load the resource into an instance variable and authorize it for every action.
|
83
|
-
|
84
|
-
```ruby
|
85
|
-
class ArticlesController < ApplicationController
|
86
|
-
load_and_authorize_resource
|
87
|
-
|
88
|
-
def show
|
89
|
-
# @article is already loaded and authorized
|
90
|
-
end
|
91
|
-
end
|
92
|
-
```
|
93
|
-
|
94
|
-
See [Authorizing Controller Actions](https://github.com/CanCanCommunity/cancancan/wiki/authorizing-controller-actions) for more information.
|
95
|
-
|
96
|
-
|
97
|
-
#### Strong Parameters
|
98
|
-
|
99
|
-
When using `strong_parameters` or Rails 4+, you have to sanitize inputs before saving the record, in actions such as `:create` and `:update`.
|
100
|
-
|
101
|
-
For the `:update` action, CanCan will load and authorize the resource but *not* change it automatically, so the typical usage would be something like:
|
102
|
-
|
103
|
-
```ruby
|
104
|
-
def update
|
105
|
-
if @article.update_attributes(update_params)
|
106
|
-
# hurray
|
107
|
-
else
|
108
|
-
render :edit
|
109
|
-
end
|
110
|
-
end
|
111
|
-
...
|
112
|
-
|
113
|
-
def update_params
|
114
|
-
params.require(:article).permit(:body)
|
115
|
-
end
|
116
|
-
```
|
117
|
-
|
118
|
-
For the `:create` action, CanCan will try to initialize a new instance with sanitized input by seeing if your controller will respond to the following methods (in order):
|
119
|
-
|
120
|
-
1. `create_params`
|
121
|
-
2. `<model_name>_params` such as `article_params` (this is the default convention in rails for naming your param method)
|
122
|
-
3. `resource_params` (a generically named method you could specify in each controller)
|
123
|
-
|
124
|
-
Additionally, `load_and_authorize_resource` can now take a `param_method` option to specify a custom method in the controller to run to sanitize input.
|
125
|
-
|
126
|
-
You can associate the `param_method` option with a symbol corresponding to the name of a method that will get called:
|
127
|
-
|
128
|
-
```ruby
|
129
|
-
class ArticlesController < ApplicationController
|
130
|
-
load_and_authorize_resource param_method: :my_sanitizer
|
131
|
-
|
132
|
-
def create
|
133
|
-
if @article.save
|
134
|
-
# hurray
|
135
|
-
else
|
136
|
-
render :new
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
private
|
141
|
-
|
142
|
-
def my_sanitizer
|
143
|
-
params.require(:article).permit(:name)
|
144
|
-
end
|
145
|
-
end
|
146
|
-
```
|
147
|
-
|
148
|
-
You can also use a string that will be evaluated in the context of the controller using `instance_eval` and needs to contain valid Ruby code. This does come in handy when using a PermittedParams class as suggested in Railscast 371:
|
149
|
-
|
150
|
-
load_and_authorize_resource param_method: 'permitted_params.article'
|
151
|
-
|
152
|
-
Finally, it's possible to associate `param_method` with a Proc object which will be called with the controller as the only argument:
|
153
|
-
|
154
|
-
load_and_authorize_resource param_method: Proc.new { |c| c.params.require(:article).permit(:name) }
|
155
|
-
|
156
|
-
See [Strong Parameters](https://github.com/CanCanCommunity/cancancan/wiki/Strong-Parameters) for more information.
|
157
|
-
|
158
|
-
### 3. Handle Unauthorized Access
|
159
|
-
|
160
|
-
If the user authorization fails, a `CanCan::AccessDenied` exception will be raised. You can catch this and modify its behavior in the `ApplicationController`.
|
161
|
-
|
162
|
-
```ruby
|
163
|
-
class ApplicationController < ActionController::Base
|
164
|
-
rescue_from CanCan::AccessDenied do |exception|
|
165
|
-
redirect_to root_url, :alert => exception.message
|
166
|
-
end
|
167
|
-
end
|
168
|
-
```
|
169
|
-
|
170
|
-
See [Exception Handling](https://github.com/CanCanCommunity/cancancan/wiki/exception-handling) for more information.
|
171
|
-
|
172
|
-
|
173
|
-
### 4. Lock It Down
|
174
|
-
|
175
|
-
If you want to ensure authorization happens on every action in your application, add `check_authorization` to your `ApplicationController`.
|
176
|
-
|
177
|
-
```ruby
|
178
|
-
class ApplicationController < ActionController::Base
|
179
|
-
check_authorization
|
180
|
-
end
|
181
|
-
```
|
182
|
-
|
183
|
-
This will raise an exception if authorization is not performed in an action. If you want to skip this, add `skip_authorization_check` to a controller subclass. See [Ensure Authorization](https://github.com/CanCanCommunity/cancancan/wiki/Ensure-Authorization) for more information.
|
184
|
-
|
185
|
-
|
186
|
-
## Wiki Docs
|
187
|
-
|
188
|
-
* [Upgrading to 1.6](https://github.com/CanCanCommunity/cancancan/wiki/Upgrading-to-1.6)
|
189
|
-
* [Defining Abilities](https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities)
|
190
|
-
* [Checking Abilities](https://github.com/CanCanCommunity/cancancan/wiki/Checking-Abilities)
|
191
|
-
* [Authorizing Controller Actions](https://github.com/CanCanCommunity/cancancan/wiki/Authorizing-Controller-Actions)
|
192
|
-
* [Exception Handling](https://github.com/CanCanCommunity/cancancan/wiki/Exception-Handling)
|
193
|
-
* [Changing Defaults](https://github.com/CanCanCommunity/cancancan/wiki/Changing-Defaults)
|
194
|
-
* [See more](https://github.com/CanCanCommunity/cancancan/wiki)
|
195
|
-
|
196
|
-
## Questions?
|
197
|
-
If you have any question or doubt regarding CanCanCan which you cannot find the solution to in the [documentation](https://github.com/CanCanCommunity/cancancan/wiki) or our [mailing list](http://groups.google.com/group/cancancan), please [open a question on Stackoverflow](http://stackoverflow.com/questions/ask?tags=cancancan) with tag [cancancan](http://stackoverflow.com/questions/tagged/cancancan)
|
198
|
-
|
199
|
-
## Bugs?
|
200
|
-
|
201
|
-
If you find a bug please add an [issue on GitHub](https://github.com/CanCanCommunity/cancancan/issues) or fork the project and send a pull request.
|
202
|
-
|
203
|
-
|
204
|
-
## Development
|
205
|
-
|
206
|
-
Cancancan uses [appraisals](https://github.com/thoughtbot/appraisal) to test the code base against multiple versions of Rails, as well as the different model adapters.
|
207
|
-
|
208
|
-
When first developing, you may need to run `bundle install` and then `appraisal install`, to install the different sets.
|
209
|
-
|
210
|
-
You can then run all appraisal files (like CI does), with `appraisal rake` or just run a specific set `appraisal activerecord_3.0 rake`.
|
211
|
-
|
212
|
-
See the [CONTRIBUTING](https://github.com/CanCanCommunity/cancancan/blob/develop/CONTRIBUTING.md) and [spec/README](https://github.com/CanCanCommunity/cancancan/blob/master/spec/README.rdoc) for more information.
|
213
|
-
|
214
|
-
|
215
|
-
## Special Thanks
|
216
|
-
|
217
|
-
CanCan was inspired by [declarative_authorization](https://github.com/stffn/declarative_authorization/) and [aegis](https://github.com/makandra/aegis). Also many thanks to the [CanCan contributors](https://github.com/CanCanCommunity/cancancan/contributors). See the [CHANGELOG](https://github.com/CanCanCommunity/cancancan/blob/master/CHANGELOG.rdoc) for the full list.
|
data/Rakefile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 3.2.0", :require => "active_record"
|
6
|
-
gem "actionpack", "~> 3.2.0", :require => "action_pack"
|
7
|
-
|
8
|
-
platforms :jruby do
|
9
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
10
|
-
gem "jdbc-sqlite3"
|
11
|
-
end
|
12
|
-
|
13
|
-
platforms :ruby, :mswin, :mingw do
|
14
|
-
gem "sqlite3"
|
15
|
-
end
|
16
|
-
|
17
|
-
gemspec :path => "../"
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 4.0.5", :require => "active_record"
|
6
|
-
gem "activesupport", "~> 4.0.5", :require => "active_support/all"
|
7
|
-
gem "actionpack", "~> 4.0.5", :require => "action_pack"
|
8
|
-
|
9
|
-
platforms :jruby do
|
10
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
11
|
-
gem "jdbc-sqlite3"
|
12
|
-
end
|
13
|
-
|
14
|
-
platforms :ruby, :mswin, :mingw do
|
15
|
-
gem "sqlite3"
|
16
|
-
end
|
17
|
-
|
18
|
-
gemspec :path => "../"
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 4.1.1", :require => "active_record"
|
6
|
-
gem "activesupport", "~> 4.1.1", :require => "active_support/all"
|
7
|
-
gem "actionpack", "~> 4.1.1", :require => "action_pack"
|
8
|
-
|
9
|
-
platforms :jruby do
|
10
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
11
|
-
gem "jdbc-sqlite3"
|
12
|
-
end
|
13
|
-
|
14
|
-
platforms :ruby, :mswin, :mingw do
|
15
|
-
gem "sqlite3"
|
16
|
-
end
|
17
|
-
|
18
|
-
gemspec :path => "../"
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 4.2.0", :require => "active_record"
|
6
|
-
gem "activesupport", "~> 4.2.0", :require => "active_support/all"
|
7
|
-
gem "actionpack", "~> 4.2.0", :require => "action_pack"
|
8
|
-
|
9
|
-
platforms :jruby do
|
10
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
11
|
-
gem "jdbc-sqlite3"
|
12
|
-
end
|
13
|
-
|
14
|
-
platforms :ruby, :mswin, :mingw do
|
15
|
-
gem "sqlite3"
|
16
|
-
gem "pg"
|
17
|
-
end
|
18
|
-
|
19
|
-
gemspec :path => "../"
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 5.0.0.rc1", :require => "active_record"
|
6
|
-
gem "activesupport", "~> 5.0.0.rc1", :require => "active_support/all"
|
7
|
-
gem "actionpack", "~> 5.0.0.rc1", :require => "action_pack"
|
8
|
-
|
9
|
-
platforms :jruby do
|
10
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
11
|
-
gem "jdbc-sqlite3"
|
12
|
-
end
|
13
|
-
|
14
|
-
platforms :ruby, :mswin, :mingw do
|
15
|
-
gem "sqlite3"
|
16
|
-
gem "pg"
|
17
|
-
end
|
18
|
-
|
19
|
-
gemspec :path => "../"
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activesupport", "~> 3.0", :require => "active_support/all"
|
6
|
-
gem "actionpack", "~> 3.0", :require => "action_pack"
|
7
|
-
gem "mongoid", "~> 2.0.0"
|
8
|
-
|
9
|
-
platforms :ruby, :mswin, :mingw do
|
10
|
-
gem "bson_ext", "~> 1.1"
|
11
|
-
end
|
12
|
-
|
13
|
-
platforms :jruby do
|
14
|
-
gem "mongo", "~> 1.9.2"
|
15
|
-
end
|
16
|
-
|
17
|
-
gemspec :path => "../"
|
data/gemfiles/sequel_3.x.gemfile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "sequel", "~> 3.48.0"
|
6
|
-
gem "activesupport", "~> 3.0", :require => "active_support/all"
|
7
|
-
gem "actionpack", "~> 3.0", :require => "action_pack"
|
8
|
-
|
9
|
-
platforms :jruby do
|
10
|
-
gem "jdbc-sqlite3"
|
11
|
-
end
|
12
|
-
|
13
|
-
platforms :ruby, :mswin, :mingw do
|
14
|
-
gem "sqlite3"
|
15
|
-
end
|
16
|
-
|
17
|
-
gemspec :path => "../"
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module CanCan
|
2
|
-
# For use with Inherited Resources
|
3
|
-
class InheritedResource < ControllerResource # :nodoc:
|
4
|
-
def load_resource_instance
|
5
|
-
if parent?
|
6
|
-
@controller.send :association_chain
|
7
|
-
@controller.instance_variable_get("@#{instance_name}")
|
8
|
-
elsif new_actions.include? @params[:action].to_sym
|
9
|
-
resource = @controller.send :build_resource
|
10
|
-
assign_attributes(resource)
|
11
|
-
else
|
12
|
-
@controller.send :resource
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def resource_base
|
17
|
-
@controller.send :end_of_association_chain
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module CanCan
|
2
|
-
module ModelAdapters
|
3
|
-
class ActiveRecord3Adapter < AbstractAdapter
|
4
|
-
include ActiveRecordAdapter
|
5
|
-
def self.for_class?(model_class)
|
6
|
-
model_class <= ActiveRecord::Base
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def build_relation(*where_conditions)
|
12
|
-
@model_class.where(*where_conditions).includes(joins)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|