fast_crud 0.1.14 → 0.1.17
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.
- checksums.yaml +4 -4
- data/fast_crud.gemspec +1 -1
- data/lib/fast_crud.rb +17 -1
- data/lib/fast_crud/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c383130a28b1ab4cb4dc2d0135a8a74de4939d6
|
4
|
+
data.tar.gz: b3e2fc8319845c6894d9d7885e0d891851c06e70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc192e8c2664e0c9a9e9dbb5be540167e83f5bf87dd3d38afc74c21c9e427d3618ac95d64905542073c47653df46d69e4f60bb89a2b834be1c32194edb2c74e1
|
7
|
+
data.tar.gz: 94ee1db540819b94db6035b9c19a006bc5224f3cae98dcd36d5650a1f34d21488f3420e95f6ab9475410fd6adeb3da6e476bca9810bd4bfe05a2ea415e6618ae
|
data/fast_crud.gemspec
CHANGED
data/lib/fast_crud.rb
CHANGED
@@ -3,7 +3,11 @@ require "fast_crud/version"
|
|
3
3
|
module FastCrud
|
4
4
|
class FastCrud < ActionController::Base
|
5
5
|
def index
|
6
|
-
|
6
|
+
if request.filtered_parameters.has_rkey? /_id/
|
7
|
+
@collection = nested_collection
|
8
|
+
else
|
9
|
+
@collection = model.all
|
10
|
+
end
|
7
11
|
end
|
8
12
|
|
9
13
|
def show
|
@@ -64,5 +68,17 @@ module FastCrud
|
|
64
68
|
def model
|
65
69
|
controller_name.classify.constantize
|
66
70
|
end
|
71
|
+
|
72
|
+
def nested_collection
|
73
|
+
path = request.fullpath.split("/").reject {|a| a.empty?}.last(3)
|
74
|
+
path.first.classify.constantize.find(path[1]).send(path.last)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
class Hash
|
80
|
+
def has_rkey?(search)
|
81
|
+
search = Regexp.new(search.to_s) unless search.is_a?(Regexp)
|
82
|
+
!!keys.detect{ |key| key =~ search }
|
67
83
|
end
|
68
84
|
end
|
data/lib/fast_crud/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_crud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lou
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|