active_scaffold 3.6.0.rc2 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +4 -0
- data/README.md +8 -6
- data/app/assets/javascripts/jquery/active_scaffold.js +1 -1
- data/lib/active_scaffold/bridges/bitfields.rb +1 -1
- data/lib/active_scaffold/bridges/bitfields/list_ui.rb +19 -0
- data/lib/active_scaffold/extensions/action_view_rendering.rb +66 -25
- data/lib/active_scaffold/extensions/localize.rb +1 -1
- data/lib/active_scaffold/helpers/form_column_helpers.rb +2 -2
- data/lib/active_scaffold/helpers/list_column_helpers.rb +6 -2
- data/lib/active_scaffold/helpers/view_helpers.rb +1 -1
- data/lib/active_scaffold/tableless.rb +15 -1
- data/lib/active_scaffold/version.rb +1 -1
- data/lib/generators/active_scaffold/install_generator.rb +51 -3
- data/test/extensions/action_view_rendering_test.rb +20 -0
- data/test/misc/tableless_test.rb +8 -0
- data/test/mock_app/app/controllers/people_controller.rb +2 -0
- data/test/mock_app/app/controllers/roles_controller.rb +4 -0
- data/test/mock_app/app/views/active_scaffold_overrides/_form.html.erb +2 -0
- data/test/mock_app/app/views/active_scaffold_overrides/list.html.erb +2 -0
- data/test/mock_app/app/views/people/_first_name_form_column.html.erb +2 -0
- data/test/mock_app/app/views/people/_form.html.erb +2 -0
- data/test/mock_app/app/views/people/list.html.erb +2 -0
- data/test/test_helper.rb +2 -2
- metadata +21 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c98847307a3be61b8137eba789a6e1779c2c9dccc9190b8c4d50428d6dffd33
|
4
|
+
data.tar.gz: f82b68052234f72ac8bc715eb88f7aabaed422e8ef8b929b63244e9d3cf5500d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a60af5b75baee4785e3ad1bc3353a59db2e2677aa14f82eabac52dd5d732486185731e1f2e66cb35f3bf3ebac14322ea3038bdca39c497bd163a600566d13198
|
7
|
+
data.tar.gz: 59bddf1ef940582d370591bd4003408505733abd2c45f7cac115f3033d8925266f92339c1deb6aae2c484a73ebe27e137d6b518b3199064fea187f5726f35ba4
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
- Fix i18n at ruby 3.0.0
|
2
|
+
- Add list helper for bitfield column, so it display labels of selected checkboxes in list
|
3
|
+
- Support rails 6.0
|
4
|
+
|
1
5
|
= 3.6.0.rc2
|
2
6
|
- Fix subform crud in subform subgroup when controller is embedded
|
3
7
|
- Fix sorting for mongoid models, broken in 3.6.0.rc1
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
|
1
2
|
Overview
|
2
3
|
========
|
3
|
-
[![Build status](https://travis-ci.
|
4
|
+
[![Build status](https://travis-ci.com/activescaffold/active_scaffold.svg?branch=master)](https://travis-ci.com/activescaffold/active_scaffold)
|
4
5
|
[![Code Climate](https://codeclimate.com/github/activescaffold/active_scaffold/badges/gpa.svg)](https://codeclimate.com/github/activescaffold/active_scaffold)
|
5
6
|
[![Test Coverage](https://codeclimate.com/github/activescaffold/active_scaffold/badges/coverage.svg)](https://codeclimate.com/github/activescaffold/active_scaffold)
|
6
7
|
[![Dependency Status](https://gemnasium.com/activescaffold/active_scaffold.svg)](https://gemnasium.com/activescaffold/active_scaffold)
|
@@ -8,10 +9,11 @@ Overview
|
|
8
9
|
[![Inline docs](https://inch-ci.org/github/activescaffold/active_scaffold.svg?branch=master)](https://inch-ci.org/github/activescaffold/active_scaffold)
|
9
10
|
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
|
10
11
|
|
11
|
-
ActiveScaffold provides a quick and powerful user interfaces for CRUD (create, read, update, delete) operations for Rails applications. It offers additonal features including searching, pagination & layout control. Rails >= 4.2.0 is supported, ruby >= 2.3 required.
|
12
|
+
ActiveScaffold provides a quick and powerful user interfaces for CRUD (create, read, update, delete) operations for Rails applications. It offers additonal features including searching, pagination & layout control. Rails >= 4.2.0 and Rails < 6.1 is supported, ruby >= 2.3 required.
|
12
13
|
|
13
14
|
Branch Details
|
14
15
|
--------------
|
16
|
+
3-6-stable supports rails >= 4.2.x and ruby >= 2.3.0
|
15
17
|
3-5-stable supports rails >= 4.0.x and ruby >= 2.0.0
|
16
18
|
3-4-stable supports rails >= 3.2.x and ruby >= 1.9.3
|
17
19
|
3-3-stable supports rails >= 3.2.x and ruby >= 1.8
|
@@ -25,12 +27,12 @@ Added to Gemfile
|
|
25
27
|
|
26
28
|
gem 'active_scaffold'
|
27
29
|
|
28
|
-
For rails >= 5.1, add jquery to application.js before rails-ujs
|
29
|
-
|
30
|
-
//= require jquery
|
30
|
+
For rails >= 5.1, add jquery-rails to Gemfile, and install generator will jquery to application.js before rails-ujs. Also it's possible to load jquery in your layout before application.js using CDN (e.g. jquery-rails-cdn). You can replace rails-ujs with jquery_ujs, although rails-ujs should work (never load both).
|
31
31
|
|
32
32
|
gem 'jquery-rails'
|
33
33
|
|
34
|
+
For rails >= 6.0, installer generator will create app/assets/javascripts/application.js, add it to assets.precompile array and add javascript_include_tag in layout, as ActiveScaffold doesn't work with webpack yet. Jquery may be loaded by packs or assets pipeline.
|
35
|
+
|
34
36
|
Run the following commands, for rails 4.2
|
35
37
|
|
36
38
|
bundle install
|
@@ -39,7 +41,7 @@ Run the following commands, for rails 4.2
|
|
39
41
|
rails g active_scaffold:resource Model [attrs]
|
40
42
|
bundle exec rake db:migrate
|
41
43
|
|
42
|
-
Or run the following commands, for rails 5
|
44
|
+
Or run the following commands, for rails >= 5
|
43
45
|
|
44
46
|
bundle install
|
45
47
|
rails g active_scaffold:install
|
@@ -1464,7 +1464,7 @@ ActiveScaffold.ActionLink.Table = ActiveScaffold.ActionLink.Abstract.extend({
|
|
1464
1464
|
else {
|
1465
1465
|
throw 'Unknown position "' + this.position + '"'
|
1466
1466
|
}
|
1467
|
-
ActiveScaffold.highlight(this.adapter.find('td').first().children());
|
1467
|
+
ActiveScaffold.highlight(this.adapter.find('td').first().children().not('script'));
|
1468
1468
|
ActiveScaffold.focus_first_element_of_form(this.adapter);
|
1469
1469
|
}
|
1470
1470
|
});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class ActiveScaffold::Bridges::Bitfields < ActiveScaffold::DataStructures::Bridge
|
2
2
|
def self.install
|
3
|
-
|
3
|
+
Dir[File.join(__dir__, 'bitfields', '*.rb')].each { |file| require file }
|
4
4
|
ActiveScaffold::Config::Core.send :prepend, ActiveScaffold::Bridges::Bitfields::BitfieldsBridge
|
5
5
|
ActiveScaffold::Config::Core.after_config_callbacks << :_setup_bitfields
|
6
6
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ActiveScaffold
|
2
|
+
module Bridges
|
3
|
+
class Bitfields
|
4
|
+
module ListColumnHelpers
|
5
|
+
def format_column_value(record, column, value = nil)
|
6
|
+
if record.class.respond_to?(:bitfields) && record.class.bitfields&.include?(column.name)
|
7
|
+
value = record.bitfield_values(column.name).select { |_, v| v }.keys
|
8
|
+
safe_join active_scaffold_config.columns.select { |c| c.name.in? value }.map(&:label), ', '
|
9
|
+
else
|
10
|
+
super
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
ActionView::Base.class_eval do
|
18
|
+
include ActiveScaffold::Bridges::Bitfields::ListColumnHelpers
|
19
|
+
end
|
@@ -45,31 +45,7 @@ module ActiveScaffold #:nodoc:
|
|
45
45
|
@_view_paths ||= lookup_context.view_paths.clone
|
46
46
|
@_last_template ||= lookup_context.last_template
|
47
47
|
end
|
48
|
-
|
49
|
-
template = parts.pop
|
50
|
-
prefix = parts.join('/')
|
51
|
-
|
52
|
-
options = args[1] || {}
|
53
|
-
options[:locals] ||= {}
|
54
|
-
if view_stack.last
|
55
|
-
options[:locals] = view_stack.last[:locals].merge!(options[:locals]) if view_stack.last[:locals]
|
56
|
-
options[:object] ||= view_stack.last[:object] if view_stack.last[:object]
|
57
|
-
end
|
58
|
-
options[:template] = template
|
59
|
-
# if prefix is active_scaffold_overrides we must try to render with this prefix in following paths
|
60
|
-
if prefix != 'active_scaffold_overrides'
|
61
|
-
options[:prefixes] = lookup_context.prefixes.drop((lookup_context.prefixes.find_index(prefix) || -1) + 1)
|
62
|
-
else
|
63
|
-
options[:prefixes] = ['active_scaffold_overrides']
|
64
|
-
last_view_path = File.expand_path(File.dirname(File.dirname(lookup_context.last_template.inspect)), Rails.root)
|
65
|
-
new_view_paths = view_paths.drop(view_paths.find_index { |path| path.to_s == last_view_path } + 1)
|
66
|
-
if @lookup_context
|
67
|
-
@lookup_context = build_lookup_context(new_view_paths)
|
68
|
-
else
|
69
|
-
lookup_context.view_paths = new_view_paths
|
70
|
-
end
|
71
|
-
end
|
72
|
-
result = super options
|
48
|
+
result = super options_for_render_super(args[1])
|
73
49
|
@lookup_context = @_lookup_context if @_lookup_context # rails 6
|
74
50
|
lookup_context.view_paths = @_view_paths if @_view_paths # rails < 6
|
75
51
|
lookup_context.last_template = @_last_template if @_last_template # rails < 6
|
@@ -103,6 +79,46 @@ module ActiveScaffold #:nodoc:
|
|
103
79
|
|
104
80
|
private
|
105
81
|
|
82
|
+
def options_for_render_super(options)
|
83
|
+
options ||= {}
|
84
|
+
options[:locals] ||= {}
|
85
|
+
if view_stack.last
|
86
|
+
options[:locals] = view_stack.last[:locals].merge!(options[:locals]) if view_stack.last[:locals]
|
87
|
+
options[:object] ||= view_stack.last[:object] if view_stack.last[:object]
|
88
|
+
end
|
89
|
+
|
90
|
+
parts = @virtual_path.split('/')
|
91
|
+
options[:template] = parts.pop
|
92
|
+
prefix = parts.join('/')
|
93
|
+
# if prefix is active_scaffold_overrides we must try to render with this prefix in following paths
|
94
|
+
if prefix != 'active_scaffold_overrides'
|
95
|
+
options[:prefixes] = lookup_context.prefixes.drop((lookup_context.prefixes.find_index(prefix) || -1) + 1)
|
96
|
+
else
|
97
|
+
options[:prefixes] = ['active_scaffold_overrides']
|
98
|
+
update_view_paths
|
99
|
+
end
|
100
|
+
options
|
101
|
+
end
|
102
|
+
|
103
|
+
def update_view_paths
|
104
|
+
last_view_path =
|
105
|
+
if @lookup_context # rails 6
|
106
|
+
File.expand_path(File.dirname(File.dirname(@lookup_context.last_template.short_identifier.to_s)), Rails.root)
|
107
|
+
else
|
108
|
+
File.expand_path(File.dirname(File.dirname(lookup_context.last_template.inspect)), Rails.root)
|
109
|
+
end
|
110
|
+
new_view_paths = view_paths.drop(view_paths.find_index { |path| path.to_s == last_view_path } + 1)
|
111
|
+
if @lookup_context # rails 6
|
112
|
+
if respond_to? :build_lookup_context # rails 6.0
|
113
|
+
build_lookup_context(new_view_paths)
|
114
|
+
else # rails 6.1
|
115
|
+
@lookup_context = ActionView::LookupContext.new(new_view_paths)
|
116
|
+
end
|
117
|
+
else
|
118
|
+
lookup_context.view_paths = new_view_paths
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
106
122
|
def render_embedded(options)
|
107
123
|
require 'digest/md5'
|
108
124
|
|
@@ -153,5 +169,30 @@ module ActionView
|
|
153
169
|
Base.class_eval do
|
154
170
|
include ActiveScaffold::RenderingHelper
|
155
171
|
end
|
172
|
+
|
173
|
+
if Gem.loaded_specs['rails'].version.segments.first >= 6
|
174
|
+
RenderingHelper.class_eval do
|
175
|
+
# override the render method to use our @lookup_context instead of the
|
176
|
+
# memoized @_lookup_context
|
177
|
+
def render(options = {}, locals = {}, &block)
|
178
|
+
case options
|
179
|
+
when Hash
|
180
|
+
in_rendering_context(options) do |_|
|
181
|
+
# previously set view paths and lookup context are lost here
|
182
|
+
# if you use view_renderer, so instead create a new renderer
|
183
|
+
# with our context
|
184
|
+
temp_renderer = ActionView::Renderer.new(@lookup_context)
|
185
|
+
if block_given?
|
186
|
+
temp_renderer.render_partial(self, options.merge(partial: options[:layout]), &block)
|
187
|
+
else
|
188
|
+
temp_renderer.render(self, options)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
else
|
192
|
+
view_renderer.render_partial(self, partial: options, locals: locals, &block)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
156
197
|
end
|
157
198
|
end
|
@@ -3,7 +3,7 @@ class Object
|
|
3
3
|
if key.present?
|
4
4
|
scope = [:active_scaffold, *options.delete(:scope)]
|
5
5
|
options = options.reverse_merge(:scope => scope, :default => key.is_a?(String) ? key : key.to_s.titleize)
|
6
|
-
text = I18n.translate(key.to_s, options).html_safe # rubocop:disable Rails/OutputSafety
|
6
|
+
text = I18n.translate(key.to_s, **options).html_safe # rubocop:disable Rails/OutputSafety
|
7
7
|
# text = nil if text.include?('translation missing:')
|
8
8
|
end
|
9
9
|
text || key
|
@@ -740,14 +740,14 @@ module ActiveScaffold
|
|
740
740
|
|
741
741
|
# Minimum
|
742
742
|
unless options[:min]
|
743
|
-
min = validators.map { |v| v.options[:
|
743
|
+
min = validators.map { |v| v.options[:greater_than_or_equal_to] }.compact.max
|
744
744
|
greater_than = validators.map { |v| v.options[:greater_than] }.compact.max
|
745
745
|
numerical_constraints[:min] = [min, (greater_than + margin if greater_than)].compact.max
|
746
746
|
end
|
747
747
|
|
748
748
|
# Maximum
|
749
749
|
unless options[:max]
|
750
|
-
max = validators.map { |v| v.options[:
|
750
|
+
max = validators.map { |v| v.options[:less_than_or_equal_to] }.compact.min
|
751
751
|
less_than = validators.map { |v| v.options[:less_than] }.compact.min
|
752
752
|
numerical_constraints[:max] = [max, (less_than - margin if less_than)].compact.min
|
753
753
|
end
|
@@ -170,8 +170,12 @@ module ActiveScaffold
|
|
170
170
|
|
171
171
|
def column_association_size(record, column, value)
|
172
172
|
cached_counts = @counts&.dig(column.name)
|
173
|
-
|
174
|
-
|
173
|
+
if cached_counts
|
174
|
+
key = column.association.primary_key if count_on_association_class?(column)
|
175
|
+
cached_counts[record.send(key || :id)] || 0
|
176
|
+
else
|
177
|
+
value.size
|
178
|
+
end
|
175
179
|
end
|
176
180
|
|
177
181
|
def format_number_value(value, options = {})
|
@@ -41,7 +41,7 @@ module ActiveScaffold
|
|
41
41
|
restore_view_paths = lookup_context.view_paths
|
42
42
|
lookup_context.view_paths = @_view_paths
|
43
43
|
end
|
44
|
-
lookup_context.exists?(template_name, '', partial).tap do
|
44
|
+
(@_lookup_context || lookup_context).exists?(template_name, '', partial).tap do
|
45
45
|
lookup_context.view_paths = restore_view_paths if @_view_paths
|
46
46
|
end
|
47
47
|
end
|
@@ -34,6 +34,12 @@ class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/App
|
|
34
34
|
def columns(table_name)
|
35
35
|
klass.columns
|
36
36
|
end
|
37
|
+
|
38
|
+
if Rails.version >= '6.0.0'
|
39
|
+
def data_sources
|
40
|
+
klass ? [klass.table_name] : []
|
41
|
+
end
|
42
|
+
end
|
37
43
|
end
|
38
44
|
|
39
45
|
class Column < ActiveRecord::ConnectionAdapters::Column
|
@@ -149,9 +155,17 @@ class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/App
|
|
149
155
|
def execute_simple_calculation(operation, column_name, distinct)
|
150
156
|
@klass.execute_simple_calculation(self, operation, column_name, distinct)
|
151
157
|
end
|
158
|
+
|
159
|
+
def implicit_order_column
|
160
|
+
@klass.implicit_order_column
|
161
|
+
end
|
162
|
+
|
163
|
+
def exists?
|
164
|
+
limit(1).to_a.present?
|
165
|
+
end
|
152
166
|
end
|
153
167
|
|
154
|
-
class Relation < ActiveRecord::Relation
|
168
|
+
class Relation < ::ActiveRecord::Relation
|
155
169
|
include RelationExtension
|
156
170
|
end
|
157
171
|
class << self
|
@@ -14,18 +14,23 @@ module ActiveScaffold
|
|
14
14
|
def add_to_javascript_manifest
|
15
15
|
file = 'app/assets/javascripts/application.js'
|
16
16
|
unless File.exist?(file)
|
17
|
+
if Rails.version >= '6.0'
|
18
|
+
create_javascript_manifest file
|
19
|
+
return
|
20
|
+
end
|
17
21
|
say_status :missing, file, :red
|
18
22
|
return if options[:pretend]
|
19
23
|
raise Thor::Error, "JS file #{file} is required for ActiveScaffold"
|
20
24
|
end
|
21
25
|
original_js = File.binread(file)
|
22
26
|
if original_js.include?('require active_scaffold')
|
23
|
-
say_status('skipped',
|
27
|
+
say_status('skipped', "insert into #{file}", :yellow)
|
24
28
|
else
|
25
|
-
insert_into_file
|
29
|
+
insert_into_file file, after: %r{//= require +.*ujs['"]?\n} do
|
26
30
|
"//= require active_scaffold\n"
|
27
31
|
end
|
28
32
|
end
|
33
|
+
setup_jquery file, original_js
|
29
34
|
end
|
30
35
|
|
31
36
|
def add_to_stylesheet_manifest
|
@@ -35,11 +40,54 @@ module ActiveScaffold
|
|
35
40
|
if original_css =~ /require active_scaffold$/
|
36
41
|
say_status('skipped', 'insert into app/assets/stylesheets/application.css', :yellow)
|
37
42
|
else
|
38
|
-
insert_into_file 'app/assets/stylesheets/application.css', :
|
43
|
+
insert_into_file 'app/assets/stylesheets/application.css', before: %r{[ ]*\*/} do
|
39
44
|
" *= require active_scaffold\n"
|
40
45
|
end
|
41
46
|
end
|
42
47
|
end
|
48
|
+
|
49
|
+
protected
|
50
|
+
|
51
|
+
def create_javascript_manifest(file)
|
52
|
+
FileUtils.mkdir_p File.dirname(file)
|
53
|
+
File.open(file, 'w') do |f|
|
54
|
+
f << "// This is a manifest file that'll be compiled into application.js, which will include all the files
|
55
|
+
// listed below.
|
56
|
+
//
|
57
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
|
58
|
+
// vendor/assets/javascripts directory can be referenced here using a relative path.
|
59
|
+
//
|
60
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
61
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
62
|
+
//
|
63
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
64
|
+
// about supported directives.
|
65
|
+
//
|
66
|
+
//= require active_scaffold
|
67
|
+
"
|
68
|
+
say_status('create', file)
|
69
|
+
end
|
70
|
+
insert_into_file 'app/views/layouts/application.html.erb', after: /javascript_pack_tag 'application'.*\n/ do
|
71
|
+
" <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>\n"
|
72
|
+
end
|
73
|
+
append_to_file 'config/initializers/assets.rb' do
|
74
|
+
"Rails.application.config.assets.precompile += %w( application.js )\n"
|
75
|
+
end
|
76
|
+
setup_jquery file, where: 'active_scaffold'
|
77
|
+
end
|
78
|
+
|
79
|
+
def setup_jquery(file, original_js = nil, where: 'ujs')
|
80
|
+
original_js ||= File.binread(file)
|
81
|
+
if ActiveScaffold.js_framework == :jquery
|
82
|
+
unless original_js.include?('require jquery')
|
83
|
+
insert_into_file file, before: %r{//= require +.*#{where}['"]?\n} do
|
84
|
+
"//= require jquery\n"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
else
|
88
|
+
say_status('missing', 'no jquery-rails gem, load jquery in your layout, or add jquery-rails to Gemfile and add //= require jquery to application.js', :red)
|
89
|
+
end
|
90
|
+
end
|
43
91
|
end
|
44
92
|
end
|
45
93
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ActionViewRenderingTest < ActionController::TestCase
|
4
|
+
setup do
|
5
|
+
@controller = PeopleController.new
|
6
|
+
end
|
7
|
+
|
8
|
+
test 'render :super twice' do
|
9
|
+
get :index
|
10
|
+
assert_select '#controller', 1
|
11
|
+
assert_select '#app', 1
|
12
|
+
end
|
13
|
+
|
14
|
+
test 'render partial override with render :super twice' do
|
15
|
+
get :new
|
16
|
+
assert_select '#first_name_field', 1
|
17
|
+
assert_select '#controller_form', 1
|
18
|
+
assert_select '#app_form', 1
|
19
|
+
end
|
20
|
+
end
|
data/test/misc/tableless_test.rb
CHANGED
@@ -25,6 +25,10 @@ class TablelessTest < MiniTest::Test
|
|
25
25
|
|
26
26
|
def test_find_with_association
|
27
27
|
assert Person.new.files.empty?
|
28
|
+
@person = Person.new
|
29
|
+
@person.save(validate: false)
|
30
|
+
assert @person.files.empty?
|
31
|
+
assert_equal [], @person.files.to_a
|
28
32
|
end
|
29
33
|
|
30
34
|
def test_tableless_assoc_with_dependent
|
@@ -35,6 +39,10 @@ class TablelessTest < MiniTest::Test
|
|
35
39
|
|
36
40
|
def test_find_with_through_association
|
37
41
|
assert Building.new.files.empty?
|
42
|
+
@building = Building.new
|
43
|
+
@building.save(validate: false)
|
44
|
+
assert @building.files.empty?
|
45
|
+
assert_equal [], @building.files.to_a
|
38
46
|
end
|
39
47
|
|
40
48
|
def test_new
|
data/test/test_helper.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'simplecov' if
|
1
|
+
require 'simplecov' if ENV['COVERAGE']
|
2
2
|
|
3
3
|
ENV['RAILS_ENV'] = 'test'
|
4
4
|
require 'mock_app/config/environment'
|
5
5
|
require 'rails/test_help'
|
6
6
|
require 'minitest/autorun'
|
7
|
-
require 'mocha/
|
7
|
+
require 'mocha/minitest'
|
8
8
|
require 'cow_proxy'
|
9
9
|
|
10
10
|
require 'minitest/reporters'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.0
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Many, see README
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -224,6 +224,7 @@ files:
|
|
224
224
|
- lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb
|
225
225
|
- lib/active_scaffold/bridges/bitfields.rb
|
226
226
|
- lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb
|
227
|
+
- lib/active_scaffold/bridges/bitfields/list_ui.rb
|
227
228
|
- lib/active_scaffold/bridges/calendar_date_select.rb
|
228
229
|
- lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb
|
229
230
|
- lib/active_scaffold/bridges/cancan.rb
|
@@ -377,6 +378,7 @@ files:
|
|
377
378
|
- test/data_structures/standard_column_test.rb
|
378
379
|
- test/data_structures/validation_reflection_test.rb
|
379
380
|
- test/data_structures/virtual_column_test.rb
|
381
|
+
- test/extensions/action_view_rendering_test.rb
|
380
382
|
- test/extensions/active_record_test.rb
|
381
383
|
- test/extensions/routing_mapper_test.rb
|
382
384
|
- test/helpers/form_column_helpers_test.rb
|
@@ -404,6 +406,7 @@ files:
|
|
404
406
|
- test/mock_app/app/controllers/contacts_controller.rb
|
405
407
|
- test/mock_app/app/controllers/floors_controller.rb
|
406
408
|
- test/mock_app/app/controllers/people_controller.rb
|
409
|
+
- test/mock_app/app/controllers/roles_controller.rb
|
407
410
|
- test/mock_app/app/helpers/application_helper.rb
|
408
411
|
- test/mock_app/app/models/address.rb
|
409
412
|
- test/mock_app/app/models/building.rb
|
@@ -413,6 +416,11 @@ files:
|
|
413
416
|
- test/mock_app/app/models/floor.rb
|
414
417
|
- test/mock_app/app/models/person.rb
|
415
418
|
- test/mock_app/app/models/role.rb
|
419
|
+
- test/mock_app/app/views/active_scaffold_overrides/_form.html.erb
|
420
|
+
- test/mock_app/app/views/active_scaffold_overrides/list.html.erb
|
421
|
+
- test/mock_app/app/views/people/_first_name_form_column.html.erb
|
422
|
+
- test/mock_app/app/views/people/_form.html.erb
|
423
|
+
- test/mock_app/app/views/people/list.html.erb
|
416
424
|
- test/mock_app/config.ru
|
417
425
|
- test/mock_app/config/application.rb
|
418
426
|
- test/mock_app/config/boot.rb
|
@@ -457,11 +465,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
457
465
|
version: '2.3'
|
458
466
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
459
467
|
requirements:
|
460
|
-
- - "
|
468
|
+
- - ">="
|
461
469
|
- !ruby/object:Gem::Version
|
462
|
-
version:
|
470
|
+
version: '0'
|
463
471
|
requirements: []
|
464
|
-
|
472
|
+
rubyforge_project:
|
473
|
+
rubygems_version: 2.7.11
|
465
474
|
signing_key:
|
466
475
|
specification_version: 4
|
467
476
|
summary: Rails 4.x and 5.x versions of ActiveScaffold supporting prototype and jquery
|
@@ -498,6 +507,7 @@ test_files:
|
|
498
507
|
- test/data_structures/standard_column_test.rb
|
499
508
|
- test/data_structures/validation_reflection_test.rb
|
500
509
|
- test/data_structures/virtual_column_test.rb
|
510
|
+
- test/extensions/action_view_rendering_test.rb
|
501
511
|
- test/extensions/active_record_test.rb
|
502
512
|
- test/extensions/routing_mapper_test.rb
|
503
513
|
- test/helpers/form_column_helpers_test.rb
|
@@ -525,6 +535,7 @@ test_files:
|
|
525
535
|
- test/mock_app/app/controllers/contacts_controller.rb
|
526
536
|
- test/mock_app/app/controllers/floors_controller.rb
|
527
537
|
- test/mock_app/app/controllers/people_controller.rb
|
538
|
+
- test/mock_app/app/controllers/roles_controller.rb
|
528
539
|
- test/mock_app/app/helpers/application_helper.rb
|
529
540
|
- test/mock_app/app/models/address.rb
|
530
541
|
- test/mock_app/app/models/building.rb
|
@@ -534,6 +545,11 @@ test_files:
|
|
534
545
|
- test/mock_app/app/models/floor.rb
|
535
546
|
- test/mock_app/app/models/person.rb
|
536
547
|
- test/mock_app/app/models/role.rb
|
548
|
+
- test/mock_app/app/views/active_scaffold_overrides/_form.html.erb
|
549
|
+
- test/mock_app/app/views/active_scaffold_overrides/list.html.erb
|
550
|
+
- test/mock_app/app/views/people/_first_name_form_column.html.erb
|
551
|
+
- test/mock_app/app/views/people/_form.html.erb
|
552
|
+
- test/mock_app/app/views/people/list.html.erb
|
537
553
|
- test/mock_app/config.ru
|
538
554
|
- test/mock_app/config/application.rb
|
539
555
|
- test/mock_app/config/boot.rb
|