What I want to do is make a JSON object which contains the outlet info, as well as the switch name and the switch port corresponding to that outlet. I know how to do it without using JSON, but it will be unpleasant and I will have to repeat the process for each outlet. There must be a better way.
i looked at ActiveRecord::Serialisation and the to_json(:include => :foreign_key) semantics but as the link to my data is through a Many to Many type relation, i need a way to perform a filter on the include in order to restrict the ammount of data sent.
my tables are here http://slexy.org/view/s21MWwrcpl