active_scaffold 3.2.10 → 3.2.11
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -1
- data/frontends/default/views/_form_attribute.html.erb +1 -1
- data/lib/active_scaffold/actions/core.rb +1 -0
- data/lib/active_scaffold/actions/create.rb +9 -9
- data/lib/active_scaffold/actions/update.rb +2 -1
- data/lib/active_scaffold/config/core.rb +2 -2
- data/lib/active_scaffold/finder.rb +1 -1
- data/lib/active_scaffold/version.rb +1 -1
- metadata +16 -16
data/CHANGELOG
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
- fix nested scaffolds with update action disabled
|
3
3
|
- initial work for tableless support (index with limited options)
|
4
4
|
- fix scrolling on closing nested scaffolds
|
5
|
-
- fix calculations which were broken in 3.2.9
|
5
|
+
- fix calculations and count includes which were broken in 3.2.9
|
6
6
|
|
7
7
|
= 3.2.9
|
8
8
|
- remove duplicated conditions with constraints
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<% unless local_assigns[:only_value] %>
|
11
11
|
<%=raw active_scaffold_input_for column, scope %>
|
12
12
|
<% else %>
|
13
|
-
<%= content_tag :span, get_column_value(@record, column),
|
13
|
+
<%= content_tag :span, get_column_value(@record, column), column_options.except(:name) %>
|
14
14
|
<%= hidden_field :record, column.association ? column.association.foreign_key : column.name, active_scaffold_input_options(column, scope) -%>
|
15
15
|
<% end %>
|
16
16
|
<% if column.update_columns -%>
|
@@ -154,6 +154,7 @@ module ActiveScaffold::Actions
|
|
154
154
|
params.reject {|key, value| [:controller, :action, :id, :page, :sort, :sort_direction].include?(key.to_sym)}.each do |key, value|
|
155
155
|
next unless active_scaffold_config.model.columns_hash[key.to_s]
|
156
156
|
next if active_scaffold_constraints[key.to_sym]
|
157
|
+
next if nested? and nested.constrained_fields.include? key.to_sym
|
157
158
|
conditions[key] = value
|
158
159
|
end
|
159
160
|
conditions
|
@@ -84,14 +84,16 @@ module ActiveScaffold::Actions
|
|
84
84
|
|
85
85
|
# A somewhat complex method to actually create a new record. The complexity is from support for subforms and associated records.
|
86
86
|
# If you want to customize this behavior, consider using the +before_create_save+ and +after_create_save+ callbacks.
|
87
|
-
def do_create(
|
88
|
-
|
87
|
+
def do_create(options = {})
|
88
|
+
attributes = options[:attributes] || params[:record]
|
89
89
|
begin
|
90
90
|
active_scaffold_config.model.transaction do
|
91
|
-
@record = update_record_from_params(new_model, active_scaffold_config.create.columns,
|
91
|
+
@record = update_record_from_params(new_model, active_scaffold_config.create.columns, attributes)
|
92
92
|
apply_constraints_to_record(@record, :allow_autosave => true)
|
93
93
|
create_association_with_parent(@record) if nested?
|
94
|
-
|
94
|
+
before_create_save(@record)
|
95
|
+
self.successful = [@record.valid?, @record.associated_valid?].all? {|v| v == true} # this syntax avoids a short-circuit
|
96
|
+
create_save(@record) unless options[:skip_save]
|
95
97
|
end
|
96
98
|
rescue ActiveRecord::ActiveRecordError => ex
|
97
99
|
flash[:error] = ex.message
|
@@ -99,12 +101,10 @@ module ActiveScaffold::Actions
|
|
99
101
|
end
|
100
102
|
end
|
101
103
|
|
102
|
-
def create_save
|
103
|
-
before_create_save(@record)
|
104
|
-
self.successful = [@record.valid?, @record.associated_valid?].all? {|v| v == true} # this syntax avoids a short-circuit
|
104
|
+
def create_save(record)
|
105
105
|
if successful?
|
106
|
-
|
107
|
-
after_create_save(
|
106
|
+
record.save! and record.save_associated!
|
107
|
+
after_create_save(record)
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
@@ -76,9 +76,10 @@ module ActiveScaffold::Actions
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def update_save(options = {})
|
79
|
+
attributes = options[:attributes] || params[:record]
|
79
80
|
begin
|
80
81
|
active_scaffold_config.model.transaction do
|
81
|
-
@record = update_record_from_params(@record, active_scaffold_config.update.columns,
|
82
|
+
@record = update_record_from_params(@record, active_scaffold_config.update.columns, attributes) unless options[:no_record_param_update]
|
82
83
|
before_update_save(@record)
|
83
84
|
self.successful = [@record.valid?, @record.associated_valid?].all? {|v| v == true} # this syntax avoids a short-circuit
|
84
85
|
if successful?
|
@@ -176,9 +176,9 @@ module ActiveScaffold::Config
|
|
176
176
|
end
|
177
177
|
|
178
178
|
def self.method_missing(name, *args)
|
179
|
-
klass = "ActiveScaffold::Config::#{name.to_s.
|
179
|
+
klass = "ActiveScaffold::Config::#{name.to_s.camelcase}".constantize rescue nil
|
180
180
|
if @@actions.include? name.to_s.underscore and klass
|
181
|
-
return eval("ActiveScaffold::Config::#{name.to_s.
|
181
|
+
return eval("ActiveScaffold::Config::#{name.to_s.camelcase}")
|
182
182
|
end
|
183
183
|
super
|
184
184
|
end
|
@@ -284,7 +284,7 @@ module ActiveScaffold
|
|
284
284
|
# Returns a hash with options to count records, rejecting select and order options
|
285
285
|
# See finder_options for valid options
|
286
286
|
def count_options(find_options = {}, count_includes = nil)
|
287
|
-
count_includes ||= find_options[:includes] unless find_options[:
|
287
|
+
count_includes ||= find_options[:includes] unless find_options[:conditions].nil?
|
288
288
|
options = find_options.reject{|k,v| [:select, :reorder].include? k}
|
289
289
|
options[:includes] = count_includes
|
290
290
|
options
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 3.2.
|
9
|
+
- 11
|
10
|
+
version: 3.2.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Many, see README
|
@@ -15,10 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-05-
|
18
|
+
date: 2012-05-24 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
21
|
+
name: shoulda
|
22
|
+
prerelease: false
|
22
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
24
|
none: false
|
24
25
|
requirements:
|
@@ -28,11 +29,11 @@ dependencies:
|
|
28
29
|
segments:
|
29
30
|
- 0
|
30
31
|
version: "0"
|
32
|
+
type: :development
|
31
33
|
version_requirements: *id001
|
32
|
-
name: shoulda
|
33
|
-
prerelease: false
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
-
|
35
|
+
name: bundler
|
36
|
+
prerelease: false
|
36
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
37
38
|
none: false
|
38
39
|
requirements:
|
@@ -44,11 +45,11 @@ dependencies:
|
|
44
45
|
- 0
|
45
46
|
- 0
|
46
47
|
version: 1.0.0
|
48
|
+
type: :development
|
47
49
|
version_requirements: *id002
|
48
|
-
name: bundler
|
49
|
-
prerelease: false
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
|
-
|
51
|
+
name: rcov
|
52
|
+
prerelease: false
|
52
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
54
|
none: false
|
54
55
|
requirements:
|
@@ -58,11 +59,11 @@ dependencies:
|
|
58
59
|
segments:
|
59
60
|
- 0
|
60
61
|
version: "0"
|
62
|
+
type: :development
|
61
63
|
version_requirements: *id003
|
62
|
-
name: rcov
|
63
|
-
prerelease: false
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
|
-
|
65
|
+
name: rails
|
66
|
+
prerelease: false
|
66
67
|
requirement: &id004 !ruby/object:Gem::Requirement
|
67
68
|
none: false
|
68
69
|
requirements:
|
@@ -74,9 +75,8 @@ dependencies:
|
|
74
75
|
- 1
|
75
76
|
- 3
|
76
77
|
version: 3.1.3
|
78
|
+
type: :runtime
|
77
79
|
version_requirements: *id004
|
78
|
-
name: rails
|
79
|
-
prerelease: false
|
80
80
|
description: Save time and headaches, and create a more easily maintainable set of pages, with ActiveScaffold. ActiveScaffold handles all your CRUD (create, read, update, delete) user interface needs, leaving you more time to focus on more challenging (and interesting!) problems.
|
81
81
|
email: activescaffold@googlegroups.com
|
82
82
|
executables: []
|