has_scope 0.3 → 0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README.rdoc +18 -16
  2. data/Rakefile +1 -1
  3. metadata +1 -1
@@ -52,30 +52,30 @@ If you want it as plugin, just do:
52
52
 
53
53
  == Options
54
54
 
55
- HasScope support several options:
55
+ HasScope supports several options:
56
56
 
57
- * <tt>:type</tt> - Checks the type of the parameter sent. If set to :boolean
58
- it just calls the named scope, without any argument. By default,
59
- it does not allow hashes or arrays to be given, except if type
60
- :hash or :array are set.
57
+ * <tt>:type</tt> - Checks the type of the parameter sent. If set to :boolean
58
+ it just calls the named scope, without any argument. By default,
59
+ it does not allow hashes or arrays to be given, except if type
60
+ :hash or :array are set.
61
61
 
62
- * <tt>:only</tt> - In which actions the scope is applied.
62
+ * <tt>:only</tt> - In which actions the scope is applied.
63
63
 
64
- * <tt>:except</tt> - In which actions the scope is not applied.
64
+ * <tt>:except</tt> - In which actions the scope is not applied.
65
65
 
66
- * <tt>:as</tt> - The key in the params hash expected to find the scope.
67
- Defaults to the scope name.
66
+ * <tt>:as</tt> - The key in the params hash expected to find the scope.
67
+ Defaults to the scope name.
68
68
 
69
- * <tt>:if</tt> - Specifies a method, proc or string to call to determine
70
- if the scope should apply
69
+ * <tt>:if</tt> - Specifies a method, proc or string to call to determine
70
+ if the scope should apply
71
71
 
72
- * <tt>:unless</tt> - Specifies a method, proc or string to call to determine
73
- if the scope should NOT apply.
72
+ * <tt>:unless</tt> - Specifies a method, proc or string to call to determine
73
+ if the scope should NOT apply.
74
74
 
75
- * <tt>:default</tt> - Default value for the scope. Whenever supplied the scope
76
- is always called.
75
+ * <tt>:default</tt> - Default value for the scope. Whenever supplied the scope
76
+ is always called.
77
77
 
78
- * <tt>:allow_blank</tt> - Blank values are not sent to scopes by default. Set to true to overwrite.
78
+ * <tt>:allow_blank</tt> - Blank values are not sent to scopes by default. Set to true to overwrite.
79
79
 
80
80
  == Block usage
81
81
 
@@ -87,6 +87,8 @@ need to manipulate the given value:
87
87
  value != "all" ? scope.by_category(value) : scope
88
88
  end
89
89
 
90
+ When used with booleans, it just receives two arguments and is just invoked if true is given:
91
+
90
92
  has_scope :not_voted_by_me, :type => :boolean do |controller, scope|
91
93
  scope.not_voted_by(controller.current_user.id)
92
94
  end
data/Rakefile CHANGED
@@ -27,7 +27,7 @@ begin
27
27
  require 'jeweler'
28
28
  Jeweler::Tasks.new do |s|
29
29
  s.name = "has_scope"
30
- s.version = "0.3"
30
+ s.version = "0.4"
31
31
  s.summary = "Maps controller filters to your resource scopes"
32
32
  s.email = "contact@plataformatec.com.br"
33
33
  s.homepage = "http://github.com/plataformatec/has_scope"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_scope
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.3"
4
+ version: "0.4"
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jos\xC3\xA9 Valim"