scho
unread,Jan 26, 2011, 4:26:37 AM1/26/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to restfulx-framework
Hi Dima,
I found out, that there's a problem with polymorphic associations and
namespaces. For example, if your ruby class is called 'Vehicles::Car'
and your AS class 'Car', polymorphic belongs-to relationships does not
work.
I've tried to get along with that issue on rails side by trying to
return just 'Car' as object_type, but in the end, it led to nothing,
especially when you want to include the polymorphic association in
to_fxml.
I think, the only way, to solve that issue, is to remove the
namespaces on Flex side. On Rails side, the following adds the
namespaces again:
FLEX_TO_RAILS_CLASSES_MAP = {"Car" => "Vehicles::Car"}
def object_type=(value)
if FLEX_TO_RAILS_CLASSES_MAP[value]
value = FLEX_TO_RAILS_CLASSES_MAP[value]
end
super value
end
I've already tried to implement this in the restfulx_framework and it
seems to work.
So Dima, if you agree with that solution, I will commit my code and
send you a pull request!
Georg