rows_controller 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -4
- data/lib/rows/model.rb +14 -16
- data/lib/rows/resources.rb +4 -7
- data/lib/rows/utils.rb +1 -3
- data/lib/rows/version.rb +6 -5
- data/lib/rows/version.rb.bak +2 -2
- data/lib/rows_controller.rb +0 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3f5302bbbcb8b8e673def7d44775cfbe769725798527b0242e04a6e4ba7b05b
|
4
|
+
data.tar.gz: 85769005a96bb8692d33fbf509f27720c2bf3d19bdca62cbf295e2d09134d791
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e66beb546b78e41db7d4efa1078c0b09a53625928f42ba4b1e57ac343441db34227a63426a0c824afb5fe6cbb6963873da89127bff7c27cc4c2788e4a8d8319
|
7
|
+
data.tar.gz: 11a4524c74e15a4df0aaabba28ca4cb984a1959c5cd63518a38c8d932fc3a2fa5f469a7cf9bc7ce3418f2af529f2463782cc45ec25b08baf414915414db244ed
|
data/README.md
CHANGED
@@ -26,8 +26,8 @@ use:
|
|
26
26
|
|
27
27
|
I.e. RowsController defines all the usual methods (index, show, edit,...).
|
28
28
|
|
29
|
-
The methods may be redefined in OrdersController
|
30
|
-
methods from RowsController.
|
29
|
+
The methods may be redefined in OrdersController
|
30
|
+
(overwrites methods from RowsController).
|
31
31
|
|
32
32
|
Low level methods like 'resources' may be redefined as well.
|
33
33
|
An example:
|
@@ -70,6 +70,12 @@ be changed by e.g.:
|
|
70
70
|
The model class can be retrieved with the helper model_class.
|
71
71
|
|
72
72
|
|
73
|
+
Rails 6
|
74
|
+
-------
|
75
|
+
|
76
|
+
This gem is intended for Rails 6.
|
77
|
+
Older Rails versions may use "gem 'rows_controller', '= 2.2.2'".
|
78
|
+
|
73
79
|
Rails 5
|
74
80
|
-------
|
75
81
|
|
@@ -118,7 +124,7 @@ As usual:
|
|
118
124
|
|
119
125
|
gem 'rows_controller' # in Gemfile
|
120
126
|
bundle
|
121
|
-
( cd spec/dummy; rake db:create db:migrate )
|
127
|
+
( cd spec/dummy; rake db:create db:migrate ) # not required for Rails 6
|
122
128
|
rake
|
123
129
|
|
124
130
|
|
@@ -131,4 +137,4 @@ Look for:
|
|
131
137
|
- inherited_resources
|
132
138
|
- decent_exposure
|
133
139
|
|
134
|
-
Copyright (c) 2009-
|
140
|
+
Copyright (c) 2009-2020 [Dittmar Krall], released under the MIT license.
|
data/lib/rows/model.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
module Rows::Model
|
4
2
|
|
5
3
|
def model_class
|
@@ -7,23 +5,23 @@ module Rows::Model
|
|
7
5
|
params[:controller].singularize.camelize.constantize
|
8
6
|
end
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
if Rails::VERSION::MAJOR > 3
|
9
|
+
def model_name
|
10
|
+
@_model_name ||= model_class.model_name.name
|
11
|
+
end
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
def model_symbol
|
14
|
+
@_model_symbol ||= model_class.model_name.singular
|
15
|
+
end
|
16
|
+
else
|
17
|
+
def model_name
|
18
|
+
@_model_name ||= model_class.name
|
19
|
+
end
|
22
20
|
|
23
|
-
|
24
|
-
|
21
|
+
def model_symbol
|
22
|
+
@_model_symbol ||= model_name.underscore.gsub(%r{/}, '_')
|
23
|
+
end
|
25
24
|
end
|
26
|
-
end
|
27
25
|
|
28
26
|
def model_symbol_plural
|
29
27
|
@_model_symbol_plural ||= model_symbol.pluralize
|
data/lib/rows/resources.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
module Rows::Resources
|
4
2
|
|
5
3
|
def set_resources(rows = nil)
|
@@ -55,7 +53,6 @@ module Rows::Resources
|
|
55
53
|
return model_class.column_headers if model_class.respond_to?(:column_headers)
|
56
54
|
return ['to_s'] unless model_class.respond_to?(:content_columns)
|
57
55
|
|
58
|
-
# ['id'] + model_class.content_columns.collect { |c| c.name }
|
59
56
|
['id'] + model_class.content_columns.collect(&:name)
|
60
57
|
end
|
61
58
|
|
@@ -72,11 +69,11 @@ module Rows::Resources
|
|
72
69
|
else
|
73
70
|
pars = params[model_symbol] || {}
|
74
71
|
pars.keys.each { |x|
|
75
|
-
|
72
|
+
x = x.to_sym
|
76
73
|
unless permits.include?(x) || permits.include?({ x => [] })
|
77
|
-
|
78
|
-
|
79
|
-
|
74
|
+
pars.delete(x)
|
75
|
+
p "** WARNING: model <#{model_name}> dropping params <#{x}>"
|
76
|
+
end
|
80
77
|
}
|
81
78
|
pars
|
82
79
|
end
|
data/lib/rows/utils.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
module Rows::Utils
|
4
2
|
|
5
3
|
# formatting
|
6
4
|
def resource_format(x)
|
7
5
|
return '--'.html_safe if x.nil?
|
6
|
+
|
8
7
|
bool = x.class == Time || x.class == Date || x.class == DateTime ||
|
9
8
|
x.class == ActiveSupport::TimeWithZone
|
10
9
|
return x.strftime('%d.%m.%Y').html_safe if bool
|
@@ -18,5 +17,4 @@ module Rows::Utils
|
|
18
17
|
|
19
18
|
x.to_s.gsub(/\r*\n/, '<br/>')
|
20
19
|
end
|
21
|
-
|
22
20
|
end
|
data/lib/rows/version.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module Rows
|
2
|
-
VERSION = '3.0.
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
2
|
+
VERSION = '3.0.1'.freeze # 2020-03-01
|
3
|
+
# VERSION = '3.0.0'.freeze # 2019-10-03
|
4
|
+
# VERSION = '2.2.3' # 2019-10-03
|
5
|
+
# VERSION = '2.2.2' # 2019-05-06
|
6
|
+
# VERSION = '2.2.1' # 2019-02-18
|
7
|
+
# VERSION = '2.2.0'
|
7
8
|
end
|
data/lib/rows/version.rb.bak
CHANGED
data/lib/rows_controller.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rows_controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dittmar Krall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: appraisal
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
|
-
rubygems_version: 3.0.
|
151
|
+
rubygems_version: 3.0.8
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: RowsController DRYs your controllers.
|