Hi,

I have a model like this:

class State < ActiveRecord::Base
   has_and_belongs_to_many :adjacencies,
                                            :join_table =>
"adjacencies",
                                            :class_name => "State",
                                            :association_foreign_key
=> "adjacency_id",
                                            :conditions => { :status
=> 'active'}
  ...
end

>From the mongrel console, I found a SQL statement AS generated is like
this:

SELECT count(DISTINCT "states".id) AS count_all
       FROM "states"
       LEFT OUTER JOIN "adjacencies" ON "adjacencies".state_id =
"states".id
       LEFT OUTER JOIN "states" adjacencies_states ON
"adjacencies_states".id = "adjacencies".adjacency_id AND states.status
= 'active'

Actually I think the part "AND states.status = 'active'" should be
"AND adjacencies_states.status = 'active'".

Since I'm new to AS (I just installed it 4 hours ago), can anybody
confirm this is a bug or how I can work around this issue.

Thanks a lot!

ZhangInSeattle

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