crudify 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +24 -7
- data/config/locales/en.yml +6 -6
- data/lib/crudify/version.rb +1 -1
- metadata +77 -116
data/README.md
CHANGED
@@ -3,9 +3,24 @@ Crudify
|
|
3
3
|
|
4
4
|
A dynamic resource controller for Rails 3 that keeps your controllers nice and skinny.
|
5
5
|
|
6
|
-
Crudify was
|
6
|
+
Crudify was shamelessly robbed from [refinerycms](https://github.com/resolve/refinerycms/blob/master/core/lib/refinery/crud.rb)'s internals and customized for use in other projects. Much credit and many thanks to the guys at [resolve digital](http://resolvedigital.com/) for all their hard work on the [refinery cms project](http://resolvedigital.com/development/refinery%C2%A0cms). Keep it up!
|
7
7
|
|
8
8
|
|
9
|
+
Installation
|
10
|
+
------------
|
11
|
+
|
12
|
+
It's best to install crudify by adding your Rails 3 project's Gemfile:
|
13
|
+
|
14
|
+
# Gemfile
|
15
|
+
source "http://rubygems.org"
|
16
|
+
gem 'rails', '>= 3.0.0'
|
17
|
+
gem 'crudify', '>= 0.0.7'
|
18
|
+
|
19
|
+
Now run:
|
20
|
+
|
21
|
+
bundle install
|
22
|
+
|
23
|
+
|
9
24
|
Usage
|
10
25
|
-----
|
11
26
|
|
@@ -16,9 +31,9 @@ In its most basic form, crudify is designed to be use like this:
|
|
16
31
|
end
|
17
32
|
|
18
33
|
|
19
|
-
Ok, so what does it do? The short answer; _everything_ that you'd want it to. In more detail, crudify turns your controller into a full-fledged CRUD controller with `index`, `new`, `create`, `show`, `edit`, `update`, and `destroy`. But wait, there's more! Inside each of these standard methods are several _hook methods_ designed to make customizing your controllers even easier that
|
34
|
+
Ok, so what does it do? The short answer; _everything_ that you'd want it to. In more detail, crudify turns your controller into a full-fledged CRUD controller with `index`, `new`, `create`, `show`, `edit`, `update`, and `destroy`. But wait, there's more! Inside each of these standard methods are several _hook methods_ designed to make customizing your controllers even easier that overwriting crudify's methods. Overwriting; say what? ...
|
20
35
|
|
21
|
-
Say you want to customize an action that's being defined by crudify, simply
|
36
|
+
Say you want to customize an action that's being defined by crudify, simply overwrite it!
|
22
37
|
|
23
38
|
class JelliesController < ApplicationController
|
24
39
|
crudify :jelly
|
@@ -64,7 +79,7 @@ Just before the calls to `valid?` and `save`, you'll see `before_create`; the fi
|
|
64
79
|
end
|
65
80
|
|
66
81
|
|
67
|
-
Notice that `before_create` calls a second hook; `before_action`. This is a generic hook that fires before every crud method's call to `save`, `update` or `destroy`. This means it might be helpful for you to call `super` when
|
82
|
+
Notice that `before_create` calls a second hook; `before_action`. This is a generic hook that fires before every crud method's call to `save`, `update` or `destroy`. This means it might be helpful for you to call `super` when overwriting this method so that the chain of hooks keeps firing. Inside the `before_action` method we'll decide what to use as flash messages with `set_what`. Here's the code for `before_action`:
|
68
83
|
|
69
84
|
def before_action
|
70
85
|
# just a hook!
|
@@ -76,6 +91,8 @@ Notice that `before_create` calls a second hook; `before_action`. This is a gene
|
|
76
91
|
|
77
92
|
*Ok Ok, so we're gettin' kind of deep here.* Let's get back to the basic concept; Skinny, sexy and easy on the eyes. (Are we still talking ruby here?)
|
78
93
|
|
94
|
+
Here's an example of a `before_create` hook:
|
95
|
+
|
79
96
|
class InquiriesController < ApplicationController
|
80
97
|
crudify :inquiry
|
81
98
|
|
@@ -87,7 +104,7 @@ Notice that `before_create` calls a second hook; `before_action`. This is a gene
|
|
87
104
|
end
|
88
105
|
|
89
106
|
|
90
|
-
|
107
|
+
And a `successful_create` hook:
|
91
108
|
|
92
109
|
class InquiriesController < ApplicationController
|
93
110
|
crudify :inquiry
|
@@ -106,7 +123,7 @@ Or an after-action hook:
|
|
106
123
|
* For available **hooks**: [Crudify::HookMethods](https://github.com/citrus/crudify/blob/master/lib/crudify/hook_methods.rb)
|
107
124
|
* To see **which hooks go where**: [Cruidfy::ClassMethods](https://github.com/citrus/crudify/blob/master/lib/crudify/class_methods.rb)
|
108
125
|
|
109
|
-
|
126
|
+
Also, check out the demo app in `test/dummy`...
|
110
127
|
|
111
128
|
|
112
129
|
Testing
|
@@ -157,4 +174,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
157
174
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
158
175
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
159
176
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
160
|
-
SOFTWARE.
|
177
|
+
SOFTWARE.
|
data/config/locales/en.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
en:
|
2
2
|
crudify:
|
3
|
-
created: %{what} was successfully created.
|
4
|
-
updated: %{what} was successfully updated.
|
5
|
-
destroyed: %{what} was successfully removed.
|
6
|
-
failed_create: %{what} could not be created.
|
7
|
-
failed_update: %{what} could not be updated.
|
8
|
-
failed_destroy: %{what} could not be removed.
|
3
|
+
created: "%{what} was successfully created."
|
4
|
+
updated: "%{what} was successfully updated."
|
5
|
+
destroyed: "%{what} was successfully removed."
|
6
|
+
failed_create: "%{what} could not be created."
|
7
|
+
failed_update: "%{what} could not be updated."
|
8
|
+
failed_destroy: "%{what} could not be removed."
|
data/lib/crudify/version.rb
CHANGED
metadata
CHANGED
@@ -1,140 +1,103 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: crudify
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 6
|
9
|
-
version: 0.0.6
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.7
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Spencer Steffen
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-07-19 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rails
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70183555001860 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 3
|
30
|
-
- 0
|
31
|
-
- 0
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
32
21
|
version: 3.0.0
|
33
22
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: will_paginate
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: *70183555001860
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: will_paginate
|
27
|
+
requirement: &70183555000900 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
segments:
|
44
|
-
- 2
|
45
|
-
- 3
|
46
|
-
- 15
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
47
32
|
version: 2.3.15
|
48
33
|
type: :runtime
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: meta_search
|
52
34
|
prerelease: false
|
53
|
-
|
35
|
+
version_requirements: *70183555000900
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: meta_search
|
38
|
+
requirement: &70183554999700 !ruby/object:Gem::Requirement
|
54
39
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
segments:
|
59
|
-
- 1
|
60
|
-
- 0
|
61
|
-
- 1
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
62
43
|
version: 1.0.1
|
63
44
|
type: :runtime
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: shoulda
|
67
45
|
prerelease: false
|
68
|
-
|
46
|
+
version_requirements: *70183554999700
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: shoulda
|
49
|
+
requirement: &70183554997960 !ruby/object:Gem::Requirement
|
69
50
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
segments:
|
74
|
-
- 2
|
75
|
-
- 11
|
76
|
-
- 3
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
77
54
|
version: 2.11.3
|
78
55
|
type: :development
|
79
|
-
version_requirements: *id004
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
|
-
name: sqlite3-ruby
|
82
56
|
prerelease: false
|
83
|
-
|
57
|
+
version_requirements: *70183554997960
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: sqlite3-ruby
|
60
|
+
requirement: &70183554996640 !ruby/object:Gem::Requirement
|
84
61
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
segments:
|
89
|
-
- 1
|
90
|
-
- 3
|
91
|
-
- 3
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
92
65
|
version: 1.3.3
|
93
66
|
type: :development
|
94
|
-
version_requirements: *id005
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: capybara
|
97
67
|
prerelease: false
|
98
|
-
|
68
|
+
version_requirements: *70183554996640
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: capybara
|
71
|
+
requirement: &70183554995340 !ruby/object:Gem::Requirement
|
99
72
|
none: false
|
100
|
-
requirements:
|
101
|
-
- -
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
segments:
|
104
|
-
- 0
|
105
|
-
- 4
|
106
|
-
- 1
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
107
76
|
version: 0.4.1
|
108
77
|
type: :development
|
109
|
-
version_requirements: *id006
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: selenium-webdriver
|
112
78
|
prerelease: false
|
113
|
-
|
79
|
+
version_requirements: *70183554995340
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: selenium-webdriver
|
82
|
+
requirement: &70183554994560 !ruby/object:Gem::Requirement
|
114
83
|
none: false
|
115
|
-
requirements:
|
116
|
-
- -
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
segments:
|
119
|
-
- 0
|
120
|
-
- 1
|
121
|
-
- 3
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
122
87
|
version: 0.1.3
|
123
88
|
type: :development
|
124
|
-
|
125
|
-
|
126
|
-
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70183554994560
|
91
|
+
description: Crudify is a dynamic resource controller for Rails 3. The idea is skinny
|
92
|
+
controllers with powerful hooks for easy customization.
|
93
|
+
email:
|
127
94
|
- spencer@citrusme.com
|
128
95
|
executables: []
|
129
|
-
|
130
96
|
extensions: []
|
131
|
-
|
132
97
|
extra_rdoc_files: []
|
133
|
-
|
134
|
-
files:
|
98
|
+
files:
|
135
99
|
- .gitignore
|
136
100
|
- Gemfile
|
137
|
-
- Gemfile.lock
|
138
101
|
- LICENSE.md
|
139
102
|
- README.md
|
140
103
|
- Rakefile
|
@@ -200,39 +163,37 @@ files:
|
|
200
163
|
- test/helper.rb
|
201
164
|
- test/integration/demo_test.rb
|
202
165
|
- test/unit/crudify_test.rb
|
203
|
-
has_rdoc: true
|
204
166
|
homepage: http://github.com/citrus/crudify
|
205
167
|
licenses: []
|
206
|
-
|
207
168
|
post_install_message:
|
208
169
|
rdoc_options: []
|
209
|
-
|
210
|
-
require_paths:
|
170
|
+
require_paths:
|
211
171
|
- lib
|
212
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
172
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
213
173
|
none: false
|
214
|
-
requirements:
|
215
|
-
- -
|
216
|
-
- !ruby/object:Gem::Version
|
217
|
-
|
174
|
+
requirements:
|
175
|
+
- - ! '>='
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
segments:
|
218
179
|
- 0
|
219
|
-
|
220
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
hash: -2458031777207104316
|
181
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
221
182
|
none: false
|
222
|
-
requirements:
|
223
|
-
- -
|
224
|
-
- !ruby/object:Gem::Version
|
225
|
-
|
183
|
+
requirements:
|
184
|
+
- - ! '>='
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
segments:
|
226
188
|
- 0
|
227
|
-
|
189
|
+
hash: -2458031777207104316
|
228
190
|
requirements: []
|
229
|
-
|
230
191
|
rubyforge_project:
|
231
|
-
rubygems_version: 1.
|
192
|
+
rubygems_version: 1.8.10
|
232
193
|
signing_key:
|
233
194
|
specification_version: 3
|
234
195
|
summary: Crudify is a dynamic resource controller for Rails 3.
|
235
|
-
test_files:
|
196
|
+
test_files:
|
236
197
|
- test/dummy/Rakefile
|
237
198
|
- test/dummy/app/controllers/admin/peanut_butters_controller.rb
|
238
199
|
- test/dummy/app/controllers/application_controller.rb
|