Im still stuck on this,

The SQL generated from the console is below:
SELECT * FROM "groups" INNER JOIN "groups_subgroups" ON "groups".id =
"groups_subgroups".subgroup_id WHERE ("groups_subgroups".group_id =
7 )

And the SQL Active Scaffold is generating for

active_scaffold :group do |config|
    config.columns = [:subgroups]
end

config.nested.add_link "Subgroups", [:subgroups]
config.columns[:subgroups].association.reverse = :subgroups

is

SELECT "groups".* FROM "groups" INNER JOIN "groups_subgroups" ON
"groups_subgroups".group_id = "groups".id INNER JOIN "groups"
subgroups_groups ON "subgroups_groups".id =
"groups_subgroups".subgroup_id WHERE (groups_subgroups.subgroup_id =
E'7') ORDER BY groups."name" ASC LIMIT 15 OFFSET 0

So its getting the columns in the conditions confused -
groups_subgroups.subgroup_id = E'7' when it should be
groups_subgroups.group_id = E'7'

Ive tried various things using conditions for collection and
active_scaffold_joins, like:

def conditions_for_collection
    active_scaffold_joins << :subgroups
    "groups_subgroups.group_id = 7"
 end

But i cat seem to figure out how to solve this issue.

Can anyone help??

JB

On 20 May, 11:21, johnnybutler7 <[email protected]> wrote:
> Yes i understand.  Will try your suggestions and reply my sesults.
> Thanks!
>
> On 20 May, 08:46, "Sergio Cambra .:: entreCables S.L. ::."
>
> <[email protected]> wrote:
> > On Miércoles, 20 de Mayo de 2009 09:33:16 johnnybutler7 escribió:
>
> > > Please see below, thanks.
>
> > > ActiveScaffold::MalformedConstraint (Malformed constraint
> > > `Group#groups'. If it's a legitimate column, and you are using a
> > > nested scaffold, please specify or double-check the reverse
> > > association name.):
>
> > groups is neither a column nor an association, I think you must set reverse 
> > to
> > subgroups, look at generated sql query, and compare it with sql you get in
> > console. Maybe you can fix it adding conditions_for_collection or
> > active_scaffold_joins methods to your controller.
>
> > >     /vendor/plugins/active_scaffold/lib/active_scaffold/constraints.rb:
> > > 42:in `each'
> > >     /vendor/plugins/active_scaffold/lib/active_scaffold/constraints.rb:
> > > 42:in `conditions_from_constraints'
> > >     /vendor/plugins/active_scaffold/lib/active_scaffold/finder.rb:
> > > 125:in `all_conditions'
> > >     /vendor/plugins/active_scaffold/lib/active_scaffold/finder.rb:
> > > 158:in `find_page'
> > >     /vendor/plugins/active_scaffold/lib/active_scaffold/actions/
> > > list.rb:65:in `do_list'
> > >     /vendor/plugins/active_scaffold/lib/active_scaffold/actions/
> > > list.rb:12:in `table'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/base.rb:1253:in `send'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/base.rb:1253:in `perform_action_without_filters'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/filters.rb:617:in `call_filters'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/filters.rb:610:in `perform_action_without_benchmark'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/benchmarking.rb:68:in
> > > `perform_action_without_rescue'
> > >     c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/benchmarking.rb:68:in
> > > `perform_action_without_rescue'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/rescue.rb:136:in `perform_action_without_caching'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/caching/sql_cache.rb:13:in `perform_action'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
> > > active_record/connection_adapters/abstract/query_cache.rb:34:in
> > > `cache'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
> > > active_record/query_cache.rb:8:in `cache'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/caching/sql_cache.rb:12:in `perform_action'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/base.rb:524:in `send'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/base.rb:524:in `process_without_filters'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/filters.rb:606:in
> > > `process_without_session_management_support'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/session_management.rb:134:in `process'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/components.rb:62:in `process_with_components'
> > >     /vendor/plugins/active_scaffold/lib/extensions/
> > > component_response_with_namespacing.rb:13:in `component_response'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/components.rb:91:in
> > > `render_component_as_string_without_deprecation'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/components.rb:152:in `component_logging'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/components.rb:90:in
> > > `render_component_as_string_without_deprecation'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
> > > active_support/deprecation.rb:94:in `render_component_as_string'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/components.rb:68:in `__send__'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/components.rb:68:in `render_component'
> > >     /vendor/plugins/active_scaffold/lib/extensions/
> > > action_view_rendering.rb:59:in `render'
> > >     /vendor/plugins/active_scaffold/frontends/default/views/
> > > _nested.rhtml:39:in
> > > `_run_rhtml_vendor47plugins47active_scaffold47frontends47default47views47_n
> > >ested46rhtml_locals_nested_object'
> > > /vendor/plugins/active_scaffold/frontends/default/views/
> > > _nested.rhtml:11:in `each'
> > >     /vendor/plugins/active_scaffold/frontends/default/views/
> > > _nested.rhtml:11:in
> > > `_run_rhtml_vendor47plugins47active_scaffold47frontends47default47views47_n
> > >ested46rhtml_locals_nested_object'
> > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> > > renderable.rb:39:in `send'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> > > renderable.rb:39:in `render'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> > > renderable_partial.rb:20:in `render'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/benchmarking.rb:26:in `benchmark'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
> > > active_support/core_ext/benchmark.rb:8:in `realtime'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/benchmarking.rb:26:in `benchmark'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> > > renderable_partial.rb:19:in `render'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> > > template.rb:73:in `render_template'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> > > renderable_partial.rb:45:in `render_partial'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> > > partials.rb:152:in `render_partial'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> > > base.rb:258:in `render_without_active_scaffold'
> > >     /vendor/plugins/active_scaffold/lib/extensions/
> > > action_view_rendering.rb:61:in `render'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/base.rb:926:in `render_without_benchmark'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/benchmarking.rb:51:in
> > > `render_without_active_scaffold'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
> > > active_support/core_ext/benchmark.rb:8:in `realtime'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/benchmarking.rb:51:in
> > > `render_without_active_scaffold'
> > >     /vendor/plugins/active_scaffold/lib/extensions/
> > > action_controller_rendering.rb:13:in `render'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/base.rb:948:in `render_to_string'
> > >     /vendor/plugins/active_scaffold/lib/extensions/
> > > action_controller_rendering.rb:9:in `render'
> > >     /vendor/plugins/active_scaffold/lib/active_scaffold/actions/
> > > nested.rb:18:in `nested'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/mime_responds.rb:135:in `call'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/mime_responds.rb:135:in `custom'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/mime_responds.rb:164:in `call'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/mime_responds.rb:164:in `respond'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/mime_responds.rb:158:in `each'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/mime_responds.rb:158:in `respond'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/mime_responds.rb:107:in `respond_to'
> > >     /vendor/plugins/active_scaffold/lib/active_scaffold/actions/
> > > nested.rb:16:in `nested'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/base.rb:1253:in `send'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/base.rb:1253:in `perform_action_without_filters'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/filters.rb:617:in `call_filters'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/filters.rb:610:in `perform_action_without_benchmark'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/benchmarking.rb:68:in
> > > `perform_action_without_rescue'
> > >     c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/benchmarking.rb:68:in
> > > `perform_action_without_rescue'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/rescue.rb:136:in `perform_action_without_caching'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> > > action_controller/caching/sql_cache.rb:13:in `perform_action'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
> > > active_record/connection_adapters/abstract/query_cache.rb:34:in
> > > `cache'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/
> > > active_record/query_cache.rb:8:in `cache'
> > >     c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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