resourcify 0.1.1 → 0.1.3
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/README.md +1 -1
- data/lib/resourcify/resourcify.rb +32 -5
- data/lib/resourcify/version.rb +1 -1
- metadata +15 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9fdba8888dc484edfca49f3cf1b66efe1b25a65
|
4
|
+
data.tar.gz: f4e8ddcb1e5fdd383406f262ef39fd80f84445c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c1c8cb94ebb2c13afcf86bb02f56b7ff7c7e288a077ad38e850175ba76f26aa62548763ae2da538d1483b12759be1ca671980d122a7eb3705bd26273b764a41
|
7
|
+
data.tar.gz: 1e87d2cbf8051934f92d016b042aa3ddacc63860bc52a931100546e5d7f9b35b24abf20c8c3d6124ca24d7d0da331433bc4e5a237a33607259ea2dd7ee2053f9
|
data/README.md
CHANGED
@@ -59,7 +59,7 @@ You can override this by defining a custom method called "permitted_params" (or
|
|
59
59
|
|
60
60
|
### Models
|
61
61
|
|
62
|
-
|
62
|
+
Assuming you have the following models (Post, User) in your application.
|
63
63
|
|
64
64
|
```ruby
|
65
65
|
class Post < ActiveRecord::Base
|
@@ -32,6 +32,19 @@ module Resourcify
|
|
32
32
|
|
33
33
|
# Include instance methods
|
34
34
|
send :include, ModelInstanceMethods
|
35
|
+
|
36
|
+
# Set options
|
37
|
+
cattr_accessor :resourcify_options
|
38
|
+
self.resourcify_options = options
|
39
|
+
|
40
|
+
options.each do |key, val|
|
41
|
+
cattr_accessor "resourcify_#{key.to_s}".to_sym
|
42
|
+
self.send("resourcify_#{key.to_s}=", val)
|
43
|
+
|
44
|
+
cattr_accessor "rfy_#{key.to_s}".to_sym
|
45
|
+
self.send("rfy_#{key.to_s}=", val)
|
46
|
+
end
|
47
|
+
|
35
48
|
elsif self.ancestors.include?(ActionController::Base) # controllers
|
36
49
|
# Turn off layout
|
37
50
|
layout false
|
@@ -53,11 +66,25 @@ module Resourcify
|
|
53
66
|
send :include, Controller::Base
|
54
67
|
|
55
68
|
# Include RESTful actions
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
69
|
+
if !options[:actions] || options[:actions].include?(:index)
|
70
|
+
send :include, Controller::Actions::Index
|
71
|
+
end
|
72
|
+
|
73
|
+
if !options[:actions] || options[:actions].include?(:create)
|
74
|
+
send :include, Controller::Actions::Create
|
75
|
+
end
|
76
|
+
|
77
|
+
if !options[:actions] || options[:actions].include?(:show)
|
78
|
+
send :include, Controller::Actions::Show
|
79
|
+
end
|
80
|
+
|
81
|
+
if !options[:actions] || options[:actions].include?(:update)
|
82
|
+
send :include, Controller::Actions::Update
|
83
|
+
end
|
84
|
+
|
85
|
+
if !options[:actions] || options[:actions].include?(:destroy)
|
86
|
+
send :include, Controller::Actions::Destroy
|
87
|
+
end
|
61
88
|
end
|
62
89
|
end
|
63
90
|
end
|
data/lib/resourcify/version.rb
CHANGED
metadata
CHANGED
@@ -1,60 +1,60 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resourcify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Baidu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pundit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sqlite3
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Resourcify rails controllers and models
|
56
56
|
email:
|
57
|
-
-
|
57
|
+
- stephenbaidu@gmail.com
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
@@ -123,7 +123,7 @@ files:
|
|
123
123
|
- test/dummy/test/models/foo_test.rb
|
124
124
|
- test/resourcify_test.rb
|
125
125
|
- test/test_helper.rb
|
126
|
-
homepage:
|
126
|
+
homepage: https://github.com/stephenbaidu/resourcify
|
127
127
|
licenses: []
|
128
128
|
metadata: {}
|
129
129
|
post_install_message:
|
@@ -132,17 +132,17 @@ require_paths:
|
|
132
132
|
- lib
|
133
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
|
-
- -
|
135
|
+
- - ">="
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
139
|
requirements:
|
140
|
-
- -
|
140
|
+
- - ">="
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
144
|
rubyforge_project:
|
145
|
-
rubygems_version: 2.
|
145
|
+
rubygems_version: 2.4.5
|
146
146
|
signing_key:
|
147
147
|
specification_version: 4
|
148
148
|
summary: Resourcify rails controllers and models
|
@@ -195,4 +195,3 @@ test_files:
|
|
195
195
|
- test/dummy/test/models/foo_test.rb
|
196
196
|
- test/resourcify_test.rb
|
197
197
|
- test/test_helper.rb
|
198
|
-
has_rdoc:
|