Hi,

I'm working on jRuby 1.2.0 with ra
I have a "aspen_connections" with multiple "paths" with multiple
"tares".
I'm trying to define my models to show a scaffold of
"aspen_connections" having "tares", with nested scaffold for paths.
I have the following models:

#Table aspen_connections has 'id', 'name', ...
class AspenConnection < ActiveRecord::Base
  has_many :paths
  has_many :tares, :through => :paths
   ...
end

#Table paths has 'id', 'aspen_connection_id',  ...
class Path < ActiveRecord::Base
  belongs_to :aspen_connection
  has_many :tares
   ...
end

#Table tares has 'id', 'path_id', 'tare_type', ...
class Tare < ActiveRecord::Base
  belongs_to :path
  has_one :aspen_connection, :through => :path
   ...
end

In my views, I have an aspen_connection/view_tares.html.erb

<%= render :active_scaffold => 'aspen_connections', :conditions =>
{ :tares => {:tare_type => '3' } }, :joins => " INNER JOIN tares ON
tares.path_id = paths.id " %>


At first, I tried without the 'joins' parameter, but it crashes with
the following error:

ActiveRecord::ActiveRecordError: ERROR: missing FROM-clause entry for
table "tares":
SELECT count(DISTINCT "aspen_connections".id) AS count_all FROM
"aspen_connections"
LEFT OUTER JOIN "aspen_topo_files" ON "aspen_topo_files".id =
"aspen_connections".aspen_topo_file_id
LEFT OUTER JOIN "customers" ON "customers".id =
"aspen_connections".customer_id
LEFT OUTER JOIN "connection_edges" ON
connection_edges.aspen_connection_id = aspen_connections.id
LEFT OUTER JOIN "paths" ON paths.aspen_connection_id =
aspen_connections.id
LEFT OUTER JOIN "protections" ON "protections".id =
"aspen_connections".protection_id
WHERE ("tares"."tare_type" = '3')

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