All,

AS 2.1
Rails 2.1

I have two models, MedicalFacility and MedicalFaciiltyCategory which are 
HABTM to each other.

In the MedicalFacilityController, I pull both the MedicalFacility 
records, as well as their related MedicalFacilityCategory records, using 
a joins_for_collection like so:

  def joins_for_collection
    [:medical_facility_categories]
  end

When I get the result set back for the AS "list" action, the result set 
hash has "id" set to the ID of the MedicalFacilityCategory and 
"medical_facility_id" set to the ID of the MedicalFacility.  This is 
fine in the sense that there is no conflict between the two "id" columns 
in the result set.

However, it is not acceptable. 

What happens is that because "id" is the _category_ id, all of the 
action links in the scaffold are using it to access the _facility_, 
which is wrong.
Similarly in the JSON output which is used by an iPhone client, the 
client is pulling up the same _facility_ because it is using the same 
"id" (from the category).

I need the result set to have "id" be the id of the MedicalFacility and 
some other column (e.g. medical_facility_category_id) be the id of the 
MedicalFacilityCategory.

Is there any way for me to influence how the result set has keys are 
named?  Ideally, I'd like to do this via standard AS configuration 
settings, but if I have to post-process the result set hash before any 
of the AS rendering happens, I'm happy to do that.

I will be investigating on my own and will publish any findings, of course.

Thanks,
Wes

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to