Problem with Rails 3 and AMF , rails3-amf, RocketAMF
im trying to get AMF to work with Rails3.
I have succesfully installed rails3-amf-0.1.0 gem and the RocketAMF-0.2.1 gem.

In my app there is a controller with the following code:

    def getRandomCards
      @incoming = params[0]
      @cards = Cardvo.first
      respond_with(@cards) do |format|
          format.amf { render :amf => @cards.to_amf}  
      end
    end

through a call from Actionscript i would like to return some data in amf format.

further more, as mentioned in the instructions for rails3-amf i did the following.
in my production.rb under config/environment i added the line

    config.rails3amf.map_params :controller => 'CardvosController', :action => 'getRandomCards'

an my amf gateway got 

    config.rails3amf.gateway_path = "/gateway"

The problem is:

Any call from Actionscript / Flash raises the following
(taken from the log )

    Started POST "/gateway" for 192.178.168.1 at Fri Nov 19 15:13:28 +0100 2010
      Processing by CardvosController#getRandomCards as AMF
      Parameters: {0=>100.0}
      [1m[36mSQL (0.4ms)[0m  [1mSHOW TABLES[0m
      [1m[35mCardvo Load (0.2ms)[0m  SELECT `cardvos`.* FROM `cardvos` LIMIT 1
    Completed 200 OK in 13ms (Views: 0.9ms | ActiveRecord: 0.5ms)

    NoMethodError (undefined method `constructed?' for #<RocketAMF::Envelope:0x39ba868>):

The Amf file is created but the method, which is in remoting.rb from RocketAMF could not be found.
I think the error is thrown at request_parser.rb from Rails3AMF asking for constructed?

      # Wrap request and response
      env['rack.input'].rewind
      env['rails3amf.request'] = RocketAMF::Envelope.new.populate_from_stream(env['rack.input'].read)
      env['rails3amf.response'] = RocketAMF::Envelope.new

      # Pass up the chain to the request processor, or whatever is layered in between
      result = @app.call(env)

      # Calculate length and return response
      if env['rails3amf.response'].constructed?

For me it seems it is looking at the wron class for the method.
Where
    NoMethodError (undefined method `constructed?' for #RocketAMF::Envelope:0x39ba868):

the essential part is 
    RocketAMF::Envelope:0x39ba868 
which should be 
    RocketAMF:ANOTHER_CLASS:Envelope:0x39ba868

Am i right and where the heck is the error ?
Any help would be appreciated!

 chris







Problem with Rails 3 and AMF , rails3-amf, RocketAMF
===

im trying to get AMF to work with Rails3.
I have succesfully installed rails3-amf-0.1.0 gem and the RocketAMF-0.2.1 gem.

In my app there is a controller with the following code:

    def getRandomCards
      @incoming = params[0]
      @cards = Cardvo.first
      respond_with(@cards) do |format|
          format.amf { render :amf => @cards.to_amf}  
      end
    end

through a call from Actionscript i would like to return some data in amf format.

further more, as mentioned in the instructions for rails3-amf i did the following.
in my production.rb under config/environment i added the line

    config.rails3amf.map_params :controller => 'CardvosController', :action => 'getRandomCards'

an my amf gateway got 

    config.rails3amf.gateway_path = "/gateway"

The problem is:

Any call from Actionscript / Flash raises the following
(taken from the log )

    Started POST "/gateway" for 192.178.168.1 at Fri Nov 19 15:13:28 +0100 2010
      Processing by CardvosController#getRandomCards as AMF
      Parameters: {0=>100.0}
      [1m[36mSQL (0.4ms)[0m  [1mSHOW TABLES[0m
      [1m[35mCardvo Load (0.2ms)[0m  SELECT `cardvos`.* FROM `cardvos` LIMIT 1
    Completed 200 OK in 13ms (Views: 0.9ms | ActiveRecord: 0.5ms)

    NoMethodError (undefined method `constructed?' for #<RocketAMF::Envelope:0x39ba868>):

The Amf file is created but the method, which is in remoting.rb from RocketAMF could not be found.
I think the error is thrown at request_parser.rb from Rails3AMF asking for constructed?

      # Wrap request and response
      env['rack.input'].rewind
      env['rails3amf.request'] = RocketAMF::Envelope.new.populate_from_stream(env['rack.input'].read)
      env['rails3amf.response'] = RocketAMF::Envelope.new

      # Pass up the chain to the request processor, or whatever is layered in between
      result = @app.call(env)

      # Calculate length and return response
      if env['rails3amf.response'].constructed?

For me it seems it is looking at the wron class for the method.
Where
    NoMethodError (undefined method `constructed?' for #RocketAMF::Envelope:0x39ba868):

the essential part is 
    RocketAMF::Envelope:0x39ba868 
which should be 
    RocketAMF:ANOTHER_CLASS:Envelope:0x39ba868

Am i right and where the heck is the error ?
Any help would be appreciated!

 chris






