Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cancan
Manage
Activity
Members
Plan
External wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Github Mirror
coopdevs
cancan
Commits
1f81b8dd
Commit
1f81b8dd
authored
14 years ago
by
Ryan Bates
Browse files
Options
Downloads
Patches
Plain Diff
use 'send' to access controller current_ability in case it's private
parent
3391c5a0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.rdoc
+2
-2
2 additions, 2 deletions
CHANGELOG.rdoc
lib/cancan/controller_resource.rb
+7
-3
7 additions, 3 deletions
lib/cancan/controller_resource.rb
with
9 additions
and
5 deletions
CHANGELOG.rdoc
+
2
−
2
View file @
1f81b8dd
...
...
@@ -10,9 +10,9 @@
* Abilities can be defined with a string of SQL in addition to a block so accessible_by works with a block - see issue #150
* Adding etter support for InheritedResource - see issue #23
* Adding
b
etter support for InheritedResource - see issue #23
* Loading the collection instance variable
with
accessible_by - see issue #137
* Loading the collection instance variable
(for index action) using
accessible_by - see issue #137
* Adding action and subject variables to I18n unauthorized message - closes #142
...
...
This diff is collapsed.
Click to expand it.
lib/cancan/controller_resource.rb
+
7
−
3
View file @
1f81b8dd
...
...
@@ -53,11 +53,11 @@ module CanCan
def
load_collection?
resource_base
.
respond_to?
(
:accessible_by
)
&&
!
@controller
.
current_ability
.
has_block?
(
authorization_action
,
resource_class
)
!
current_ability
.
has_block?
(
authorization_action
,
resource_class
)
end
def
load_collection
resource_base
.
accessible_by
(
@controller
.
current_ability
)
resource_base
.
accessible_by
(
current_ability
)
end
def
build_resource
...
...
@@ -70,7 +70,7 @@ module CanCan
end
def
initial_attributes
@controller
.
current_ability
.
attributes_for
(
@params
[
:action
].
to_sym
,
resource_class
)
current_ability
.
attributes_for
(
@params
[
:action
].
to_sym
,
resource_class
)
end
def
find_resource
...
...
@@ -156,6 +156,10 @@ module CanCan
end
end
def
current_ability
@controller
.
send
(
:current_ability
)
end
def
name
@name
||
name_from_controller
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment