active_scaffold 3.2.1 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,8 @@ subform_div_id = "#{sub_form_id({:association => column.name, :id => parent_reco
9
9
  -%>
10
10
  <h5><%= column.label -%></h5>
11
11
  <div id ="<%= subform_div_id %>" <%= 'style="display: none;"'.html_safe if column.collapsed -%>>
12
+ <%# HACK to be able to delete all associated records %>
13
+ <%= hidden_field_tag "#{active_scaffold_input_options(column)[:name]}[0]", '' if column.plural_association? %>
12
14
  <%= render :partial => subform_partial_for_column(column), :locals => {:column => column, :parent_record => parent_record, :associated => associated, :show_blank_record => show_blank_record} %>
13
15
  </div>
14
16
  <%= link_to_visibility_toggle(subform_div_id, {:default_visible => !column.collapsed}) -%>
@@ -1,5 +1,5 @@
1
1
  <%
2
- column_count = if nested?
2
+ column_count = if nested? and action_name == 'index'
3
3
  active_scaffold_config_for(nested.parent_model).list.columns.count + 1
4
4
  else
5
5
  active_scaffold_config.list.columns.count + 1
@@ -34,7 +34,7 @@ module ActiveScaffold::Actions
34
34
  def create_respond_to_html
35
35
  if params[:iframe]=='true' # was this an iframe post ?
36
36
  responds_to_parent do
37
- render :action => 'on_create', :format => [:js], :layout => false
37
+ render :action => 'on_create', :formats => [:js], :layout => false
38
38
  end
39
39
  else
40
40
  if successful?
@@ -36,7 +36,7 @@ module ActiveScaffold::Actions
36
36
  params.delete(:embedded)
37
37
  render(:partial => 'list_with_header')
38
38
  else
39
- render :action => 'refresh_list', :format => [:js]
39
+ render :action => 'refresh_list', :formats => [:js]
40
40
  end
41
41
  end
42
42
  def list_respond_to_xml
@@ -2,7 +2,7 @@ module ActiveScaffold::Actions
2
2
  module Subform
3
3
  def edit_associated
4
4
  do_edit_associated
5
- render :action => 'edit_associated', :format => [:js]
5
+ render :action => 'edit_associated', :formats => [:js]
6
6
  end
7
7
 
8
8
  protected
@@ -35,7 +35,7 @@ module ActiveScaffold::Actions
35
35
  def update_respond_to_html
36
36
  if params[:iframe]=='true' # was this an iframe post ?
37
37
  responds_to_parent do
38
- render :action => 'on_update', :format => [:js], :layout => false
38
+ render :action => 'on_update', :formats => [:js], :layout => false
39
39
  end
40
40
  else # just a regular post
41
41
  if successful?
@@ -60,9 +60,6 @@ module ActiveScaffold
60
60
 
61
61
  # we avoid assigning a value that already exists because otherwise has_one associations will break (AR bug in has_one_association.rb#replace)
62
62
  parent_record.send("#{column.name}=", value) unless parent_record.send(column.name) == value
63
-
64
- elsif column.plural_association?
65
- parent_record.send("#{column.name}=", [])
66
63
  end
67
64
  end
68
65
 
@@ -139,7 +136,8 @@ module ActiveScaffold
139
136
  elsif column.singular_association?
140
137
  manage_nested_record_from_params(parent_record, column, value)
141
138
  elsif column.plural_association?
142
- value.collect {|key_value_pair| manage_nested_record_from_params(parent_record, column, key_value_pair[1])}.compact
139
+ # HACK to be able to delete all associated records, hash will include "0" => ""
140
+ value.collect {|key, value| manage_nested_record_from_params(parent_record, column, value) unless value == ""}.compact
143
141
  else
144
142
  value
145
143
  end
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- PATCH = 1
5
+ PATCH = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
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: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
- - 1
10
- version: 3.2.1
9
+ - 2
10
+ version: 3.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Many, see README
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-09 00:00:00 Z
18
+ date: 2012-03-15 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  type: :development