netzke-cancan 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -4,16 +4,20 @@ netzke-cancan simply adds all {cancan}[https://github.com/ryanb/cancan] controll
4
4
 
5
5
  == Installation
6
6
 
7
- In Rails 3, add this to your gem file and run the +bundle+ command.
7
+ In Rails 3 and with the latest netzke version, add this to your gem file and run the +bundle+ command.
8
8
 
9
9
  gem 'netzke-cancan'
10
10
 
11
+ If you are on Netzke 0.7.x, add this to your gemfile:
12
+
13
+ gem 'netzke-cancan', '~> 0.7.0'
14
+
11
15
  == Usage
12
16
 
13
17
  Simply use all cancan helper methods like can?, cannot? or authorize! in your Netzke components the same way you would do that inside of your controller.
14
18
 
15
19
  == Contributing to netzke-cancan
16
-
20
+
17
21
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
18
22
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
19
23
  * Fork the project.
data/lib/netzke/cancan.rb CHANGED
@@ -1,14 +1,16 @@
1
1
  module Netzke
2
2
  class Base
3
3
 
4
- # This method is returns the current ability with the current user from netzke
4
+ # This method returns the current ability with the current user from
5
+ # the controller.
5
6
  #
6
7
  # @return [Ability]
7
8
  def current_ability
8
- @current_ability ||= Ability.new(Netzke::Core.current_user)
9
+ @current_ability ||= Ability.new(Netzke::Base.controller.current_user)
9
10
  end
10
11
 
11
- # cancan calls helper_method, which is present in any controller, but not in a netzke components
12
+ # cancan calls helper_method, which is present in any controller, but not
13
+ # in a netzke component
12
14
  #
13
15
  # @params *args
14
16
  def self.helper_method(*args)
@@ -18,4 +20,4 @@ module Netzke
18
20
  # Include the cancan controller additions
19
21
  include ::CanCan::ControllerAdditions
20
22
  end
21
- end
23
+ end
@@ -2,7 +2,7 @@ module Netzke
2
2
  module CanCan
3
3
  module Version
4
4
  MAJOR = 0
5
- MINOR = 7
5
+ MINOR = 8
6
6
  PATCH = 0
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Netzke::CanCan do
4
4
  before(:each) do
5
5
  user = Object.new
6
- stub(Netzke::Core).current_user{user}
6
+ stub(Netzke::Base).controller.stub!.current_user{user}
7
7
  @component = TestComponent.new
8
8
  end
9
9
 
@@ -14,7 +14,7 @@ describe Netzke::CanCan do
14
14
  it "should respond to cannot?" do
15
15
  @component.should respond_to(:cannot?)
16
16
  end
17
-
17
+
18
18
  describe "#current_ability" do
19
19
  it "should respond_to current_ability" do
20
20
  @component.should respond_to(:current_ability)
@@ -24,4 +24,4 @@ describe Netzke::CanCan do
24
24
  @component.current_ability.should be_a(Ability)
25
25
  end
26
26
  end
27
- end
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netzke-cancan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -131,3 +131,4 @@ signing_key:
131
131
  specification_version: 3
132
132
  summary: Enables cancan in Netzke components
133
133
  test_files: []
134
+ has_rdoc: