The Dev Pages

A knowledge base for web applications development (and beyond)

Archive for January, 2010




I’ll have to re-duplicate the exact error message on ruby’s side. From what I recall, this was obscured by a bunch of weird error messages that were deep in the codebase for rubyamf.

Basically, if your rails server barfs a bunch of errors when you try and load activerecord objects from an amf request, one cause of this can be the fact that you have associations setup in your rubyamf_config.rb file, and there are bad or missing foreign keys in the database for linking associated tables.

In the following example ruby barks when an account is loaded. Account has a location_id in the database to a location. If the location record with that id does not exist, ruby does not throw a nice error.


ClassMappings.register(:actionscript => 'Account', :ruby => 'Account', :type => 'active_record',
    :attributes => ["id", "location_id", "verified", "org_id", "login", "password", "email",  "name_title", "name_first","name_middle",
        "name_last","name_suffix","phone","phone_2","phone_3","last_login_at", "created_at", "updated_at", "business", "residential"],  
    :associations => ["locations"])