effective_resources 1.2.12 → 1.2.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df37c8d640e4e5db582da448c9018d03dc41b231
4
- data.tar.gz: c542ce72a4681f544035d888d48a199befdd023f
3
+ metadata.gz: b5e70fee638a428f79f18157693b709b98012619
4
+ data.tar.gz: 90598b13782b0538c1553181e00c822456c14914
5
5
  SHA512:
6
- metadata.gz: 6b2c7f3e1befa877422f6ab946dd63ab14f2d4fec3fbbc7bbe9dfc6c2f6432fbd6791564a3dbbf041bebad236aea9b091466b70b8a7b22ea98bd54349a8e83fa
7
- data.tar.gz: 3a57fb83a0d36764a0b79ba82e25fcea3787166638fbc08397003332ba9e0399c9cd3b2bfd2ae47b8f42eaeac6de09ee1470e1373f7c18127f5da09f6dd34192
6
+ metadata.gz: 9012ba03094e3701829fbdf23259c2d119287c57025bba3c44a074436011b01ff9f43fac36202e3a34d41a689324c164e07c4815a9473eee0075ecb7b7a147eb
7
+ data.tar.gz: 9b15ace87c1582da176f84c737246052086858a4d3971a40368bae80c9ab70dde5255f4ebd85e009d4e6ea5c13b1c3b868e29ca132646cbd688d415ab156dc5c
data/README.md CHANGED
@@ -1,26 +1,15 @@
1
1
  # Effective Resources
2
2
 
3
- The goal of this gem is to reduce the amount of code that needs to be written when developing a ruby on rails website.
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
- - The `routes.rb` as it's the single most important file in an entire app.
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
- However, all other areas of code should be automated.
8
+ It totally replaces your controller, and instead provides a simple DSL to route actions based on your form `params[:commit]`.
16
9
 
17
- This gem **replaces** the following work a rails developer would normally do:
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
- - Controllers.
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 = current_user if resource.respond_to?(: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}"
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.2.12'.freeze
2
+ VERSION = '1.2.14'.freeze
3
3
  end
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.12
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-04-30 00:00:00.000000000 Z
11
+ date: 2019-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails