active_scaffold 3.4.9 → 3.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c83a7d7ce3f57146d10cbf6134cc41c46f4753e3
4
- data.tar.gz: 4e19dd8122bde0ded7a956146709fa981d05a9bd
3
+ metadata.gz: 26af65dba6ac3fe50f666f71c4ed02abb0adda89
4
+ data.tar.gz: 619b8200bc93ba0f81d123119723ab24c12fbec5
5
5
  SHA512:
6
- metadata.gz: 397d444554b333a865f9c9302655a3d5519c48dcc1dd768be0317a66e94c29d4b70f087809ac4cca049a2ed295b4b53971811a1fcbd7c3e42a9536bea2b41de2
7
- data.tar.gz: 2e5a2a8706e97af1a82f35335e55a4abc6e97c9156e3d23ef2ad093ca868c473f9f8b425ce926600a4d013b9b05d586b31e87e22b5d8b97ab726d4dceb95aaff
6
+ metadata.gz: ce3969fced5fe06b11f6ac32735ae382f0f494a5087d0a7664eb11b1a15d6952fcf64832f2f585d0408363f10cecab1a8c6617ed90519b04b18d73fbd98cde92
7
+ data.tar.gz: be56ceb6696c945eb66872fa482166b430d417de66d26f861e6c66d9f68e03ecb1e1c06050d28a1095c7dbbd2071ae3f9b4ee29e3c455533991e54663e7d44a5
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ = 3.4.10
2
+ - singular associations on subform are always created, in other case it's not possible to enable a checkbox without filling text fields.
3
+ - process_action_link_action checks security for crud_type and action now
4
+ - fix record for add_existing_form, so it can be used on options_for_association_conditions
5
+ - :type option for action_link not needed anymore if added with action_links.member.add, it was redundant
6
+
1
7
  = 3.4.9
2
8
  - update parent data when changing a column in subform of edit form, so parent has data from form as it works in new form
3
9
  - use :only and :except options from resource line on as_routes and as_association_routes, so activescaffold actions can be selected
@@ -17,7 +17,7 @@ options = {:id => element_form_id(:action => :add_existing),
17
17
  <% end -%>
18
18
 
19
19
  <label for="<%= "record_#{active_scaffold_config.model}" %>"><%= active_scaffold_add_existing_label %></label>
20
- <%= active_scaffold_add_existing_input(:name => 'associated_id', :url_options => url_options, :object => @record) %>
20
+ <%= active_scaffold_add_existing_input(:name => 'associated_id', :url_options => url_options, :object => nested_parent_record) %>
21
21
 
22
22
  <p class="form-footer">
23
23
  <%= submit_tag as_(:add), :class => "submit" %>
@@ -156,7 +156,7 @@ module ActiveScaffold::Actions
156
156
  else
157
157
  @action_link = active_scaffold_config.action_links[action_name]
158
158
  if params[:id]
159
- crud_type_or_security_options ||= (request.post? || request.put?) ? :update : :delete
159
+ crud_type_or_security_options ||= {:crud_type => (request.post? || request.put?) ? :update : :delete, :action => action_name}
160
160
  get_row(crud_type_or_security_options)
161
161
  unless @record.nil?
162
162
  yield @record
@@ -173,7 +173,7 @@ module ActiveScaffold
173
173
  def build_record_from_params(params, column, record)
174
174
  current = record.send(column.name)
175
175
  klass = column.association.klass
176
- (column.plural_association? && !column.show_blank_record?(current)) || !attributes_hash_is_empty?(params, klass)
176
+ column.singular_association? || (column.plural_association? && !column.show_blank_record?(current)) || !attributes_hash_is_empty?(params, klass)
177
177
  end
178
178
 
179
179
  # Attempts to create or find an instance of the klass of the association in parent_column from the
@@ -1,6 +1,7 @@
1
1
  module ActiveScaffold::DataStructures
2
2
  class ActionLinks
3
3
  include Enumerable
4
+ attr_accessor :default_type
4
5
 
5
6
  def initialize
6
7
  @set = []
@@ -13,6 +14,7 @@ module ActiveScaffold::DataStructures
13
14
  link = if action.is_a?(ActiveScaffold::DataStructures::ActionLink) || action.is_a?(ActiveScaffold::DataStructures::ActionLinks)
14
15
  action
15
16
  else
17
+ options[:type] ||= default_type
16
18
  ActiveScaffold::DataStructures::ActionLink.new(action, options)
17
19
  end
18
20
  # NOTE: this duplicate check should be done by defining the comparison operator for an Action data structure
@@ -130,6 +132,7 @@ module ActiveScaffold::DataStructures
130
132
  group = ActiveScaffold::DataStructures::ActionLinks.new
131
133
  group.label = label || name
132
134
  group.name = name
135
+ group.default_type = self.name == :root ? (name.to_sym if %w(member collection).include?(name.to_s)) : default_type
133
136
  add_to_set group
134
137
  end
135
138
  group
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 4
5
- PATCH = 9
5
+ PATCH = 10
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -84,6 +84,9 @@ class Company < ActiveRecord::Base
84
84
 
85
85
  def name
86
86
  end
87
+ def name_before_type_cast
88
+ self.name.to_s
89
+ end
87
90
 
88
91
  def date
89
92
  Date.today
@@ -217,7 +217,7 @@ class AttributeParamsTest < MiniTest::Test
217
217
 
218
218
  model = update_record_from_params(model, :update, :brand, :person, :brand => 'Mercedes', :person => {:first_name => ''})
219
219
  assert_equal 'Mercedes', model.brand
220
- assert model.person.blank?, 'person should be cleared'
220
+ refute_equal person.id, model.person.id
221
221
  assert model.save
222
222
  end
223
223
 
@@ -254,14 +254,14 @@ class AttributeParamsTest < MiniTest::Test
254
254
  assert_equal 'First', model.first_name
255
255
  assert_nil Car.where(:id => car.id).first, 'previous car should be deleted'
256
256
  assert model.car.present?
257
- refute_equal car.id, model.car.id
257
+ refute_equal car.id, model.car.id
258
258
  assert model.save
259
259
 
260
260
  car = model.car.reload
261
261
  model = update_record_from_params(model, :update, :first_name, :car, :first_name => 'Name', :car => {:brand => ''})
262
262
  assert_equal 'Name', model.first_name
263
263
  assert_nil Car.where(:id => car.id).first, 'previous car should be deleted'
264
- assert model.car.blank?, 'car should be cleared'
264
+ refute_equal car.id, model.car.id
265
265
  assert model.save
266
266
  end
267
267
 
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.4.9
4
+ version: 3.4.10
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: 2014-11-12 00:00:00.000000000 Z
11
+ date: 2014-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.0
33
+ version: '1.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: 1.0.0
40
+ version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rcov
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -435,7 +435,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
435
435
  version: '0'
436
436
  requirements: []
437
437
  rubyforge_project:
438
- rubygems_version: 2.1.11
438
+ rubygems_version: 2.0.3
439
439
  signing_key:
440
440
  specification_version: 4
441
441
  summary: Rails 3.2 and 4.0 version of activescaffold supporting prototype and jquery