Custom Class Mapping

0 views
Skip to first unread message

lars

unread,
May 15, 2008, 4:58:14 AM5/15/08
to rubyamf
Hey,

I need a little help because I don't get the custom class mapping to
work. I have a very simple Flex Class MessageVO which just contains
two Strings. It is for displaying error or success messages from the
backend in the frontend. My class mapping looks like this:

ClassMappings.register(
:actioscript => 'de.myapp.app.vo.MessageVO',
:ruby => 'Message',
:type => 'custom',
:methods => ["title","text"] # You might not need this...
)

The Ruby Message model is situated in app\models\message.rb and simply
looks like this

class Message
attr_accessor :title, :text
end

Well I read that for custom VO's, I would need to specify the full
qualified path name. Well I do not know what this would be here!

So thanks for any help that will let this simple example fly ;-)

Lars

Michael Luu

unread,
May 15, 2008, 11:50:50 AM5/15/08
to rub...@googlegroups.com
you're Flex class definition should look something like this:
===================
package de.myapp.app.vo {
[RemoteClass(alias="de.myapp.app.vo.MessageVO")]
public class MessageVO {
public var title:String;
public var text:String;
}
}
====================
you want the RemoteClass to match the ClassMapping -> :actionscript part

good luck,
Mike

lars

unread,
May 16, 2008, 7:30:09 AM5/16/08
to rubyamf
Hi Michael,

thanks for the advice, I forgot to show the flex side of the example:

package de.myapp.app.vo
{
import com.adobe.cairngorm.vo.IValueObject;

[RemoteClass(alias="de.myapp.app.vo.MessageVO")]
public class MessageVO implements IValueObject
{
public var title:String;
public var text:String;
}
}

Unfortunately, no conversion done on either side :( Any ideas?
Reply all
Reply to author
Forward
0 new messages