rails-tables 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/app/tables/datatable.rb +3 -7
- data/lib/rails-tables/version.rb +1 -1
- metadata +2 -2
data/app/tables/datatable.rb
CHANGED
@@ -11,7 +11,7 @@ attr_accessor :view, :scopes
|
|
11
11
|
def render_with(view, *args)
|
12
12
|
arguments = args.pop || {}
|
13
13
|
self.view = view
|
14
|
-
self.scopes = arguments.fetch(:scopes,
|
14
|
+
self.scopes = arguments.fetch(:scopes, [])
|
15
15
|
return self
|
16
16
|
end
|
17
17
|
|
@@ -35,10 +35,6 @@ class_attribute :columns, :searches, :authorized_scopes, :match_any
|
|
35
35
|
self.searches = [] if self.searches.nil?
|
36
36
|
self.searches << Search.new(name, self, arguments)
|
37
37
|
end
|
38
|
-
def self.available_scopes(*args)
|
39
|
-
self.authorized_scopes = [] if self.authorized_scopes.nil?
|
40
|
-
self.authorized_scopes += args
|
41
|
-
end
|
42
38
|
self.match_any = true
|
43
39
|
def self.match_all_columns
|
44
40
|
self.match_any = false
|
@@ -52,8 +48,8 @@ private
|
|
52
48
|
else
|
53
49
|
objects = self.model
|
54
50
|
end
|
55
|
-
self.scopes.each do |
|
56
|
-
objects =
|
51
|
+
self.scopes.each do |scope|
|
52
|
+
objects = scope.call(objects)
|
57
53
|
end
|
58
54
|
if params[:sSearch].present?
|
59
55
|
objects = objects.send("#{self.name}_search", params[:sSearch])
|
data/lib/rails-tables/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-tables
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|