I'm building a composite association link out of two foreign keys to
the same table.

And I've tried three approaches none of which are working.
------------------------------------------------------------------------------------
class Parent < ActiveRecord::Base

  has_many :kids_m, :foreign_key => :mom_id, :class_name => "Kid"
  has_many :kids_f, :foreign_key => :dad_id, :class_name => "Kid"

# define the single composite association column
  def kids
    if (sex == "male")
      kids_m
    else
      if sex == "female"
        kids_f
      end
    end
  end

end
----------------------------------------------------------------------------------

But this results in :
#<Kid:0x2a99372f08>#<Kid:0x2a99371658>... etc

I tried turning these into links using:
------------------------------------------------------
module ParentsHelper
  def solid_secondary_analyses_column(record)
    record.kids_m.first(3).collect{|kid_m| h(kid_m)}.join(', ')   #BUT
NO LINK!!!
     # can somebody tell me how to get "link_to" working with this?
  end
end
------------------------------------------------------


I've also tried just
-----------------------------------------------------------------------------
class Parent < ApplicationController
  config.columns[:kids].set_link('nested', :parameters =>
{:associations => :kids_m})
end
-------------------------------------------------------------------
which works!  but only for one association... which brings us back to
the original problem....

Any Ideas on how to do this?

Dave
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

  • cu... dschruth
    • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
      • ... dschruth
        • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.

Reply via email to