1

I'm new to RubyAmf. I noticed that you can send an object with RubyAmf as follows:

format.amf { render :amf => @user}

Which works fine. But I wasn't sure what to do what when I have two ,or more, objects:

@projects = @user.projects
@tasks = @user.tasks

How can I can send @projects and @tasks without having to do multiple requests from flex.

Thanks,

Tam

Tam
  • 11,872
  • 19
  • 69
  • 119

1 Answers1

1

As per the RubyAMF code there is support array serialization. So the following code should work.

@projects = @user.projects
format.amf { render :amf => @projects}

If you want to send both projects and tasks together you can send them back in a hash.

format.amf { render :amf =>{:projects => @user.projects, :tasks => @user.tasks} }

Caveat: I haven't tested this code. I am inferring the functionality based on the gem code.

Harish Shetty
  • 64,083
  • 21
  • 152
  • 198
  • Thanks @KandadaBoggu but can I send both @tasks and @projects together? I know I can send @projects array as you mentioned – Tam Mar 07 '10 at 02:46