effective_resources 1.2.12 → 1.2.14
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 +27 -17
- data/app/controllers/concerns/effective/crud_controller/actions.rb +1 -1
- data/lib/effective_resources/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: b5e70fee638a428f79f18157693b709b98012619
|
4
|
+
data.tar.gz: 90598b13782b0538c1553181e00c822456c14914
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9012ba03094e3701829fbdf23259c2d119287c57025bba3c44a074436011b01ff9f43fac36202e3a34d41a689324c164e07c4815a9473eee0075ecb7b7a147eb
|
7
|
+
data.tar.gz: 9b15ace87c1582da176f84c737246052086858a4d3971a40368bae80c9ab70dde5255f4ebd85e009d4e6ea5c13b1c3b868e29ca132646cbd688d415ab156dc5c
|
data/README.md
CHANGED
@@ -1,26 +1,15 @@
|
|
1
1
|
# Effective Resources
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
It's ruby on rails, on effective rails.
|
6
|
-
|
7
|
-
A rails developer will **always** need to maintain and write:
|
3
|
+
This gem looks at the current `routes.rb`, authorization `ability.rb`, `current_user` and controller context
|
4
|
+
to metaprogram an effective CRUD website.
|
8
5
|
|
9
|
-
|
10
|
-
- The `ability.rb` or other authorization.
|
11
|
-
- A normal ApplicationRecord model file for each model, `/app/models/post.rb`.
|
12
|
-
- Its corresponding form, `/app/views/posts/_form.html.haml` and `_post.html.haml`
|
13
|
-
- Any javascript and css
|
6
|
+
It automates linking to resource edit, show, delete pages, as well as member and collection actions.
|
14
7
|
|
15
|
-
|
8
|
+
It totally replaces your controller, and instead provides a simple DSL to route actions based on your form `params[:commit]`.
|
16
9
|
|
17
|
-
|
10
|
+
The goal of this gem is to reduce the amount of code that needs to be written when developing a ruby on rails website.
|
18
11
|
|
19
|
-
|
20
|
-
- Any file named `index/edit/show/new.html`. We use rails application templates and powerful defaults views so these files need never be written.
|
21
|
-
- Writing `permitted params`. This gem implements a model dsl to define and blacklist params.
|
22
|
-
- Manually checking which actions are available to the `current_user` on each `resource` all the time.
|
23
|
-
- Writing submit buttons
|
12
|
+
It's ruby on rails, on effective rails.
|
24
13
|
|
25
14
|
|
26
15
|
## Getting Started
|
@@ -49,6 +38,27 @@ Check the `config/initializer/effective_resources.rb` and make sure it's calling
|
|
49
38
|
config.authorization_method = Proc.new { |controller, action, resource| authorize!(action, resource) } # CanCanCan
|
50
39
|
```
|
51
40
|
|
41
|
+
## Workflow
|
42
|
+
|
43
|
+
A rails developer will **always** need to maintain and write:
|
44
|
+
|
45
|
+
- The `routes.rb` as it's the single most important file in an entire app.
|
46
|
+
- The `ability.rb` or other authorization.
|
47
|
+
- A normal ApplicationRecord model file for each model, `/app/models/post.rb`.
|
48
|
+
- Its corresponding form, `/app/views/posts/_form.html.haml` and `_post.html.haml`
|
49
|
+
- Any javascript and css
|
50
|
+
|
51
|
+
However, all other areas of code should be automated.
|
52
|
+
|
53
|
+
This gem **replaces** the following work a rails developer would normally do:
|
54
|
+
|
55
|
+
- Controllers.
|
56
|
+
- Any file named `index/edit/show/new.html`. We use rails application templates and powerful defaults views so these files need never be written.
|
57
|
+
- Writing `permitted params`. This gem implements a model dsl to define and blacklist params.
|
58
|
+
- Manually checking which actions are available to the `current_user` on each `resource` all the time.
|
59
|
+
- Writing submit buttons
|
60
|
+
|
61
|
+
|
52
62
|
# Quick Start
|
53
63
|
|
54
64
|
This gem was built to quickly build CRUD interfaces. Automate all the actions, and submit buttons.
|
@@ -64,7 +64,7 @@ module Effective
|
|
64
64
|
action = (commit_action[:action] == :save ? :create : commit_action[:action])
|
65
65
|
|
66
66
|
resource.assign_attributes(send(resource_params_method_name))
|
67
|
-
resource.created_by
|
67
|
+
resource.created_by ||= current_user if resource.respond_to?(:created_by=)
|
68
68
|
|
69
69
|
EffectiveResources.authorize!(self, action, resource)
|
70
70
|
@page_title ||= "New #{resource_name.titleize}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|