[RubyAMF] RubyAMF - developers wanted

RubyAMF rubyamf-discussion at rubyforge.org
Thu Oct 4 12:02:21 EDT 2007


Did you test to see if it works still for models with :belongs_to &&
:has_many ?


On 10/4/07, RubyAMF <rubyamf-discussion at rubyforge.org> wrote:
>
> hey..
> http://www.4thtemple.com/stuff/active_record_adapter.rb
> this seems to fix the array wrapper problem.. but theres another bug ..
> lets say you do something like render :amf => addr.user and in as3, if you
> do re.return.name gets confused there.. anyway i'll work on that tomorrow
>
> On Thu, 4 Oct 2007 02:48:17 -0400
> RubyAMF <rubyamf-discussion at rubyforge.org> wrote:
>
> > On Wed, 3 Oct 2007 19:21:41 -0700
> > RubyAMF <rubyamf-discussion at rubyforge.org> wrote:
> >
> > yeah.. when stepping through run_multiple/single .. it's doing
> !ar.empty? .. but ar isn't an array .. so i fixed it so it checks both
> scenerios..
> >
> >         ok = false;
> >           if (ar.instance_of? Array)
> >                 if (!ar.empty? && !ar.nil?)
> >                    ok=true;
> >                 end
> >           end
> >
> >           if ((!ar.instance_of? Array && !ar.nil?) || ok)
> >
> >
> >
> > > U probably are getting a fault. Trace out fe.fault.faultString
> > >
> > >
> > > The box said requires Windows XP or greater. So I got a Mac.
> > >
> > > On Oct 3, 2007, at 4:15 PM, RubyAMF <rubyamf-discussion at rubyforge.org>
> > > wrote:
> > >
> > > > it's funny, ssr actually interprets this situation as a faultEvent.
> > > > Not sure why .. but I'll worry about that later.
> > > >
> > > > On Mon, 1 Oct 2007 20:49:02 -0700
> > > > RubyAMF <rubyamf-discussion at rubyforge.org> wrote:
> > > >
> > > >> Yeah, so let's say you have these models defined:
> > > >>
> > > >> class User < ActiveRecord::Base
> > > >> has_many :addresses
> > > >> end
> > > >>
> > > >> class Address < ActiveRecord::Base
> > > >> belongs_to :user
> > > >> end
> > > >>
> > > >> Now in a controller you do this:
> > > >> class MyController < ...
> > > >>  def myaction
> > > >>    myadd = Address.find(1, :include => :user)
> > > >>    render :amf => myadd
> > > >>  end
> > > >> end
> > > >>
> > > >>
> > > >> The result in RubyAMF will be a VO, and the "user" property will be
> > > >> an
> > > >> array, and the 0 index will be the "user" object. This is incorrect
> > > >> as the
> > > >> "user" property should be the user object as expected. this happens
> > > >> in the
> > > >> active_record_adapter..
> > > >>
> > > >> -Aaron
> > > >>
> > > >>
> > > >> On 10/1/07, RubyAMF <rubyamf-discussion at rubyforge.org> wrote:
> > > >>>
> > > >>> I apologize for not being familiar with much of RAMF, my project
> > > >>> hasn't
> > > >>> progressed to backend developement yet....
> > > >>>
> > > >>> But to clarify what is happening, is if a call is made to a model
> > > >>> that
> > > >>> uses foreign key constraints, the resulting object will be
> > > >>> returned to the
> > > >>> swf as an array wrapped in another array, where the real model
> > > >>> array/hash is
> > > >>> inside index 0?
> > > >>>
> > > >>> (sorry.. i havent actually gotten to the backend portion of my
> > > >>> project
> > > >>> yet..)
> > > >>>
> > > >>>> -Update the active_record_adapter to support a model association
> of
> > > >>>> :belongs_to. Currently if a model has a :belongs_to relationship,
> > > >>>> that
> > > >>>> object get's returned wrapped in an array (
> > > >>>> re.result.myModelVO.myBelongsToProperty [0]. Which is not
> > > >>>> correct. It
> > > >>> should
> > > >>>> be re.result.myModelVO.myBelognsToProperty. This happens in the
> > > >>>> active_record_adapter#run_single method, because the payload
> > > >>>> object is
> > > >>>> initially created as an array (initla_data = []). the object
> get's
> > > >>> pushed
> > > >>>> into the array. Some time needs to be put into this to correctly
> > > >>>> alter
> > > >>> the
> > > >>>> adapter so that it won't break situations where models have
> > > >>>> a :has_many
> > > >>>> relationship as well.
> > > >>> _______________________________________________
> > > >>> Rubyamf-discussion mailing list
> > > >>> Rubyamf-discussion at rubyforge.org
> > > >>> http://rubyforge.org/mailman/listinfo/rubyamf-discussion
> > > >>>
> > > >>
> > > >
> > > >
> > > > --
> > > >
> > > > _______________________________________________
> > > > Rubyamf-discussion mailing list
> > > > Rubyamf-discussion at rubyforge.org
> > > > http://rubyforge.org/mailman/listinfo/rubyamf-discussion
> > > _______________________________________________
> > > Rubyamf-discussion mailing list
> > > Rubyamf-discussion at rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/rubyamf-discussion
> >
> >
> > --
> >
> > _______________________________________________
> > Rubyamf-discussion mailing list
> > Rubyamf-discussion at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rubyamf-discussion
>
>
> --
>
> _______________________________________________
> Rubyamf-discussion mailing list
> Rubyamf-discussion at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rubyamf-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rubyamf-discussion/attachments/20071004/9f8ce5e7/attachment.html 


More information about the Rubyamf-discussion mailing list