On Martes, 23 de Febrero de 2010 21:41:42 Benjamin Adler escribió:
> On Monday 22 February 2010 17:28:47 Sergio Cambra .:: entreCables S.L. ::.
>
> wrote:
> > You get an error about catalog_items_catalog_items.catalog_item_id
> > doesn't exist. Rails is trying to join the table with that column, as you
> > can look at here:
> > LEFT OUTER JOIN `catalog_items` catalog_items_catalog_items ON
> > catalog_items_catalog_items.catalog_item_id = catalog_items.id
> >
> > Probably your association is wrong. You can test your named scope and
> > association with script/console (better with unit tests) before trying to
> > use it in ActiveScaffold.
>
> This named_scope in CatalogItem works just fine in the console:
But does association work in console? I can't help you with your association
because I don't know your schema neither your models.
> It seems I need the self-referencing association for AS to work correctly,
> but then the extra JOIN becomes a problem (even though the named scope
> still work in the console despite has_many :catalog_items being present).
> Is it possible to manually :exclude an association in the named_scope? What
> else can I try?
>
> greetings,
> ben
You can't exclude the association which you are trying to nest. Nested
scaffolds are designed to show associations. If you don't have foreign key for
the association you must set your finder_sql, or rails will try to guess the
foreign key.
Also you can set the link to a custom action, and call list action. For
example, setting the link to similar action:
config.action_links.add :similar, :type => :member
def similar
list
end
def beginning_of_chain
if action_name == 'similar'
super.isotypecontrol
else
super
end
end
--
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]
--
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.