inherited_resources 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +6 -6
- data/lib/inherited_resources.rb +13 -17
- data/lib/inherited_resources/base_helpers.rb +9 -3
- data/lib/inherited_resources/belongs_to_helpers.rb +2 -2
- data/lib/inherited_resources/engine.rb +11 -0
- data/lib/inherited_resources/version.rb +1 -1
- 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: 4c848b17107647c1d8ad488bb45dc1f25fa77c90
|
4
|
+
data.tar.gz: 881023687b11c42c47217decfc409c4b5bbf251c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03ad83ca5106a764815cd74552101c4b78bf4d719b6788a8c1e90d24d226892510630ce50c00ce7c48a2b09dce316d01ce629f5d2500282b2d9b02d2356993ba
|
7
|
+
data.tar.gz: 36f3d2b845f40be1f036c7e4cea54276e7885a430a3360be8631a38f7af79f8037c2e30994ed773b113bbf38880b0ee0121fcf265221951b2986d59d43e7df54
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
## Notice
|
2
|
-
|
2
|
+
|
3
3
|
Inherited Resources is no longer actively maintained by the original author and
|
4
4
|
has been transferred to the ActiveAdmin organization for maintenance. New feature
|
5
5
|
requests are not encouraged.
|
6
6
|
|
7
|
-
If you are not already using Inherited Resources we suggest instead using Rails'
|
7
|
+
If you are not already using Inherited Resources we suggest instead using Rails'
|
8
8
|
`respond_with` feature alongside the [responders gem](https://github.com/plataformatec/responders).
|
9
9
|
|
10
10
|
## Inherited Resources
|
11
11
|
|
12
|
-
[![Version
|
13
|
-
[![Travis CI
|
12
|
+
[![Version](http://img.shields.io/gem/v/inherited_resources.svg)](https://rubygems.org/gems/inherited_resources)
|
13
|
+
[![Travis CI](http://img.shields.io/travis/activeadmin/inherited_resources/master.svg)](https://travis-ci.org/activeadmin/inherited_resources)
|
14
14
|
|
15
15
|
Inherited Resources speeds up development by making your controllers inherit
|
16
16
|
all restful actions so you just have to focus on what is important. It makes
|
@@ -634,7 +634,7 @@ end
|
|
634
634
|
```
|
635
635
|
|
636
636
|
This code creates delete and search actions in controller (they behaves like show and
|
637
|
-
index actions accordingly). Also, it will produce `delete_resource_{path,url}` and
|
637
|
+
index actions accordingly). Also, it will produce `delete_resource_{path,url}` and
|
638
638
|
`search_resources_{path,url}` url helpers.
|
639
639
|
|
640
640
|
## What about views?
|
@@ -722,4 +722,4 @@ If you discover any bugs, please describe it in the issues tracker, including Ra
|
|
722
722
|
|
723
723
|
Questions are better handled on StackOverflow.
|
724
724
|
|
725
|
-
MIT License. Copyright (c) 2009-
|
725
|
+
MIT License. Copyright (c) 2009-2017 José Valim.
|
data/lib/inherited_resources.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# This is here because responders don't require it.
|
1
2
|
require 'rails/engine'
|
2
3
|
require 'responders'
|
4
|
+
require 'inherited_resources/engine'
|
3
5
|
require 'inherited_resources/blank_slate'
|
4
6
|
require 'inherited_resources/responder'
|
5
7
|
|
@@ -21,24 +23,18 @@ module InheritedResources
|
|
21
23
|
def self.flash_keys=(array)
|
22
24
|
Responders::FlashResponder.flash_keys = array
|
23
25
|
end
|
24
|
-
|
25
|
-
class Railtie < ::Rails::Engine
|
26
|
-
config.inherited_resources = InheritedResources
|
27
|
-
if config.respond_to?(:app_generators)
|
28
|
-
config.app_generators.scaffold_controller = :inherited_resources_controller
|
29
|
-
else
|
30
|
-
config.generators.scaffold_controller = :inherited_resources_controller
|
31
|
-
end
|
32
|
-
end
|
33
26
|
end
|
34
27
|
|
35
|
-
|
36
|
-
#
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
28
|
+
ActiveSupport.on_load(:action_controller) do
|
29
|
+
# We can remove this check and change to `on_load(:action_controller_base)` in Rails 5.2.
|
30
|
+
if self == ActionController::Base
|
31
|
+
# If you cannot inherit from InheritedResources::Base you can call
|
32
|
+
# inherit_resources in your controller to have all the required modules and
|
33
|
+
# funcionality included.
|
34
|
+
def self.inherit_resources
|
35
|
+
InheritedResources::Base.inherit_resources(self)
|
36
|
+
initialize_resources_class_accessors!
|
37
|
+
create_resources_url_helpers!
|
38
|
+
end
|
43
39
|
end
|
44
40
|
end
|
@@ -149,7 +149,7 @@ module InheritedResources
|
|
149
149
|
# Overwrite this method to provide other interpolation options when
|
150
150
|
# the flash message is going to be set.
|
151
151
|
#
|
152
|
-
# def
|
152
|
+
# def flash_interpolation_options
|
153
153
|
# { }
|
154
154
|
# end
|
155
155
|
|
@@ -223,8 +223,11 @@ module InheritedResources
|
|
223
223
|
# Get resource ivar based on the current resource controller.
|
224
224
|
#
|
225
225
|
def get_resource_ivar #:nodoc:
|
226
|
-
instance_variable_defined?(:"@#{resource_instance_name}")
|
226
|
+
if instance_variable_defined?(:"@#{resource_instance_name}")
|
227
227
|
instance_variable_get("@#{resource_instance_name}")
|
228
|
+
else
|
229
|
+
nil
|
230
|
+
end
|
228
231
|
end
|
229
232
|
|
230
233
|
# Set resource ivar based on the current resource controller.
|
@@ -236,8 +239,11 @@ module InheritedResources
|
|
236
239
|
# Get collection ivar based on the current resource controller.
|
237
240
|
#
|
238
241
|
def get_collection_ivar #:nodoc:
|
239
|
-
instance_variable_defined?(:"@#{resource_collection_name}")
|
242
|
+
if instance_variable_defined?(:"@#{resource_collection_name}")
|
240
243
|
instance_variable_get("@#{resource_collection_name}")
|
244
|
+
else
|
245
|
+
nil
|
246
|
+
end
|
241
247
|
end
|
242
248
|
|
243
249
|
# Set collection ivar based on the current resource controller.
|
@@ -75,12 +75,12 @@ module InheritedResources
|
|
75
75
|
set_parent_instance(parent_config, chain)
|
76
76
|
end
|
77
77
|
|
78
|
-
def get_parent_ivar(instance_name)
|
78
|
+
def get_parent_ivar(instance_name) #:nodoc:
|
79
79
|
instance_variable_defined?(:"@#{instance_name}") &&
|
80
80
|
instance_variable_get("@#{instance_name}")
|
81
81
|
end
|
82
82
|
|
83
|
-
def set_parent_instance(parent_config, chain)
|
83
|
+
def set_parent_instance(parent_config, chain) #:nodoc:
|
84
84
|
if parent_config[:singleton]
|
85
85
|
parent = if chain
|
86
86
|
chain.send(parent_config[:instance_name])
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module InheritedResources
|
2
|
+
class Railtie < ::Rails::Engine
|
3
|
+
config.inherited_resources = InheritedResources
|
4
|
+
|
5
|
+
if config.respond_to?(:app_generators)
|
6
|
+
config.app_generators.scaffold_controller = :inherited_resources_controller
|
7
|
+
else
|
8
|
+
config.generators.scaffold_controller = :inherited_resources_controller
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inherited_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-04-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: responders
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/inherited_resources/blank_slate.rb
|
100
100
|
- lib/inherited_resources/class_methods.rb
|
101
101
|
- lib/inherited_resources/dsl.rb
|
102
|
+
- lib/inherited_resources/engine.rb
|
102
103
|
- lib/inherited_resources/polymorphic_helpers.rb
|
103
104
|
- lib/inherited_resources/responder.rb
|
104
105
|
- lib/inherited_resources/shallow_helpers.rb
|