Right. You told Rails only to select facs.name. It's not clear from your post why you are using a :joins in a habtm association, as that should be implied, however something like this should work:
@conts = Cont.all # assumes relatively recent Rails. If older, use Cont.find(:all)
@conts.facs.each do |fac|
puts fac[:id]
end
the problem is I have to get cont.id associated with each fac (foreign key)and in the @cfacs=Fac.all(:joins=>:conts, :select=>“facs.name”) i’ll rewrite it as
@cfacs=Fac.all(:joins=>:conts, :select=>“facs.,facs_conts.,conts.*”)