crud_responder 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -21
- data/lib/crud_responder/version.rb +1 -1
- data/lib/generators/crud_responder/install_generator.rb +20 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc4c6a90000c908653f2a0a63e6fd05111888fa8
|
4
|
+
data.tar.gz: c99c02ff88014b717adb59c24623907150f1badb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f98a0eb1aa646f2951e211d664a5cc1afc7d83672919ed882ca5000832850025ecf9cd5623e746c6c6b619f40cba702bf0112cf5404bd7ba9d153ef6d155b4c
|
7
|
+
data.tar.gz: 338a0c8c5126ecfd2a6d57378949b075480b65ac79ffeedb6c217c99c35a4659bce08b983522d2722b55b119690150c9326a5bcc817e16865d27fc9885e9d153
|
data/README.md
CHANGED
@@ -84,31 +84,23 @@ gem 'crud_responder'
|
|
84
84
|
|
85
85
|
And then execute:
|
86
86
|
|
87
|
-
|
88
|
-
|
87
|
+
```Shell
|
88
|
+
$ bundle install
|
89
|
+
```
|
89
90
|
Or install it yourself as:
|
90
91
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
create:
|
99
|
-
notice: '%{resource_name} %{resource_desc} was successfully created.'
|
100
|
-
alert: '%{resource_name} %{resource_desc} cannot be created. %{errors}'
|
101
|
-
update:
|
102
|
-
notice: '%{resource_name} %{resource_desc} was successfully updated.'
|
103
|
-
alert: '%{resource_name} %{resource_desc} cannot be updated. %{errors}'
|
104
|
-
destroy:
|
105
|
-
notice: '%{resource_name} %{resource_desc} was successfully destroyed.'
|
106
|
-
alert: '%{resource_name} %{resource_desc} cannot be destroyed. %{errors}'
|
92
|
+
```Shell
|
93
|
+
$ gem install crud_responder
|
94
|
+
```
|
95
|
+
Generate initial files:
|
96
|
+
|
97
|
+
```Shell
|
98
|
+
$ rails g crud_responder:install
|
107
99
|
```
|
108
100
|
|
109
101
|
## Usage
|
110
102
|
|
111
|
-
Include `CrudResponder` into your `ApplicationController` (or whatever base controller you have)
|
103
|
+
Include `CrudResponder` into your `ApplicationController` (or whatever base controller you have). Note: generator already has included CrudResponder to Application controller.
|
112
104
|
```ruby
|
113
105
|
class ApplicationController
|
114
106
|
include CrudResponder
|
@@ -185,8 +177,8 @@ Now your controllers are skinny again! Also, you are forced to think in terms of
|
|
185
177
|
|
186
178
|
## TODO
|
187
179
|
|
188
|
-
*
|
189
|
-
* Support for pure API controllers (which is much
|
180
|
+
* Customizing flash messages
|
181
|
+
* Support for pure API controllers (which is much simpler)
|
190
182
|
* Testing
|
191
183
|
|
192
184
|
Note about pure API controllers. I already use this idea:
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module CrudResponder
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('..', __FILE__)
|
5
|
+
|
6
|
+
desc 'Creates an initializer with default crud_responder configuration and copy locale file'
|
7
|
+
|
8
|
+
def update_application_controller
|
9
|
+
inject_into_class 'app/controllers/application_controller.rb', 'ApplicationController', <<-RUBY
|
10
|
+
include CrudResponder
|
11
|
+
|
12
|
+
RUBY
|
13
|
+
end
|
14
|
+
|
15
|
+
def copy_locale
|
16
|
+
copy_file '../../../config/locales/en.yml', 'config/locales/crud_responder.en.yml'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crud_responder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Antonyan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- lib/crud_responder.rb
|
118
118
|
- lib/crud_responder/default_options.rb
|
119
119
|
- lib/crud_responder/version.rb
|
120
|
+
- lib/generators/crud_responder/install_generator.rb
|
120
121
|
homepage: https://github.com/olegantonyan/crud_responder
|
121
122
|
licenses:
|
122
123
|
- MIT
|