controller_resources 0.0.1 → 0.0.2
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a6adb74a8b9c88d7da3c10ee6cb427d9f421075c
|
|
4
|
+
data.tar.gz: 6ff37e39ae45febfc41bb6138384a67d7f5afbbd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74b2881705eb65079e7735709571990f173a72a8e4feba6516b81f4c6b04a18c8d7e17bb3a9685423fdd7d24f8f99da89efc0ab9ec051a4887843c83abd0f976
|
|
7
|
+
data.tar.gz: 070a4f87cd9b16913bcecb5bba8fb7692c7254d738aa52cb7caf91cd500c4af5b1d7fbc5dba3879321ccb3c0f04920b98040cc5838cfc6cca89898c83bcd3d23
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
module ControllerResources
|
|
2
2
|
class Engine < ::Rails::Engine
|
|
3
3
|
isolate_namespace ControllerResources
|
|
4
|
-
config.to_prepare do
|
|
5
|
-
require 'controller_resources'
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
config.to_prepare do
|
|
6
|
+
ApplicationController.class_eval do
|
|
8
7
|
include ControllerResources::Extension
|
|
9
8
|
end
|
|
10
9
|
end
|
|
@@ -53,6 +53,7 @@ module ControllerResources
|
|
|
53
53
|
#{model_class}.where(search_params)
|
|
54
54
|
end
|
|
55
55
|
#{authenticate if defined? Devise}
|
|
56
|
+
#{authorize if defined? Authority}
|
|
56
57
|
RUBY
|
|
57
58
|
|
|
58
59
|
yield if block_given?
|
|
@@ -74,8 +75,16 @@ module ControllerResources
|
|
|
74
75
|
"before_action :authenticate_user!, except: %w(index show)"
|
|
75
76
|
end
|
|
76
77
|
|
|
78
|
+
def authorize
|
|
79
|
+
"authorize_actions_for #{model_class}"
|
|
80
|
+
end
|
|
81
|
+
|
|
77
82
|
def model_class
|
|
78
|
-
@model_class ||=
|
|
83
|
+
@model_class ||= self._singleton_resource.to_s.classify
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def model
|
|
87
|
+
self._singleton_resource
|
|
79
88
|
end
|
|
80
89
|
|
|
81
90
|
def collection
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: controller_resources
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tom Scott
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-12-
|
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|