Browse files

Fixed that AWS Scaffold Fails with Struct as a Parameter (closes #4363)…

… [joe@mjg2.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4017 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent ed10f87 commit 4a968d464b32f83856761c60135e29326c6245fc @dhh dhh committed Mar 23, 2006
View
2 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).
View
3 actionwebservice/lib/action_web_service/scaffolding.rb
@@ -187,7 +187,8 @@ def method_parameter_input_fields(method, type, field_name_base, idx)
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)
View
10 actionwebservice/test/scaffolded_controller_test.rb
@@ -18,6 +18,7 @@ def ==(other)
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 @@ def test_scaffold_invoke_method_params
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'}

0 comments on commit 4a968d4

Please sign in to comment.