diff options
-rw-r--r-- | actionwebservice/CHANGELOG | 2 | ||||
-rw-r--r-- | actionwebservice/lib/action_web_service/scaffolding.rb | 3 | ||||
-rw-r--r-- | actionwebservice/test/scaffolded_controller_test.rb | 10 |
3 files changed, 14 insertions, 1 deletions
diff --git a/actionwebservice/CHANGELOG b/actionwebservice/CHANGELOG index 9f6abfdc5d..d630b13e44 100644 --- a/actionwebservice/CHANGELOG +++ b/actionwebservice/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fix Scaffold Fails with Struct as a Parameter #4363 [joe@mjg2.com] + * Fix soap type registration of multidimensional arrays (#4232) * Fix that marshaler couldn't handle ActiveRecord models defined in a different namespace (#2392). diff --git a/actionwebservice/lib/action_web_service/scaffolding.rb b/actionwebservice/lib/action_web_service/scaffolding.rb index 3f958df3ab..21689da990 100644 --- a/actionwebservice/lib/action_web_service/scaffolding.rb +++ b/actionwebservice/lib/action_web_service/scaffolding.rb @@ -187,7 +187,8 @@ module ActionWebService nested_content = method_parameter_input_fields( method, member_type, - "#{field_name_base}[#{idx}][#{member_name}]") + "#{field_name_base}[#{idx}][#{member_name}]", + idx) if member_type.custom? parameters << content_tag('li', label) parameters << content_tag('ul', nested_content) diff --git a/actionwebservice/test/scaffolded_controller_test.rb b/actionwebservice/test/scaffolded_controller_test.rb index b41d5afe09..0aa034c3b4 100644 --- a/actionwebservice/test/scaffolded_controller_test.rb +++ b/actionwebservice/test/scaffolded_controller_test.rb @@ -18,6 +18,7 @@ end class ScaffoldedControllerTestAPI < ActionWebService::API::Base api_method :hello, :expects => [{:integer=>:int}, :string], :returns => [:bool] + api_method :hello_struct_param, :expects => [{:person => ScaffoldPerson}], :returns => [:bool] api_method :bye, :returns => [[ScaffoldPerson]] api_method :date_diff, :expects => [{:start_date => :date}, {:end_date => :date}], :returns => [:int] api_method :time_diff, :expects => [{:start_time => :time}, {:end_time => :time}], :returns => [:int] @@ -31,6 +32,10 @@ class ScaffoldedController < ActionController::Base def hello(int, string) 0 end + + def hello_struct_param(person) + 0 + end def bye [ScaffoldPerson.new(:id => 1, :name => "leon"), ScaffoldPerson.new(:id => 2, :name => "paul")] @@ -69,6 +74,11 @@ class ScaffoldedControllerTest < Test::Unit::TestCase get :scaffold_invoke_method_params, :service => 'scaffolded', :method => 'Hello' assert_rendered_file 'parameters.rhtml' end + + def test_scaffold_invoke_method_params_with_struct + get :scaffold_invoke_method_params, :service => 'scaffolded', :method => 'HelloStructParam' + assert_rendered_file 'parameters.rhtml' + end def test_scaffold_invoke_submit_hello post :scaffold_invoke_submit, :service => 'scaffolded', :method => 'Hello', :method_params => {'0' => '5', '1' => 'hello world'} |