Hi, If you are really on the latest version of activescaffold please try and set he following in your controller: conf.list.pagination = :infinite
Seems that AS Count query is making trouble. pagination = :infinite does not need a count query. -- Volker On 23 Feb., 21:41, Benjamin Adler <[email protected]> wrote: > 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: > > named_scope :isotypecontrol, lambda { |conjugate, fragment, isotypeh, origin| > { :include => [:marker, :conjugate, :fragment, :isotypeh, :origin], > :conditions => ['markers.name= "Isotype Control" AND > catalog_items.conjugate_id = ? AND catalog_items.fragment_id = ? AND > catalog_items.isotypeh_id = ? AND catalog_items.origin_id = ?', conjugate, > fragment, isotypeh, origin] } } > > When trying to use it with AS, I get: > > Processing CatalogItemsController#nested (...) [GET] > Parameters: {"action"=>"nested", "_method"=>"get", > "adapter"=>"_list_inline_adapter", "id"=>"1", "controller"=>"catalog_items", > "associations"=>"catalog_items"} > CatalogItem Load (0.3ms) SELECT * FROM `catalog_items` WHERE > (`catalog_items`.`id` = 1) > ActionView::TemplateError (undefined method `association' for nil:NilClass) on > line #14 of > vendor/plugins/active_scaffold/frontends/default/views/_nested.html.erb > > After adding "has_many :catalog_items" to the same model, the error changes > to: > > ActiveRecord::StatementInvalid (Mysql::Error: Unknown column > 'catalog_items_catalog_items.catalog_item_id' in 'on clause': SELECT > count(DISTINCT `catalog_items`.id) AS count_all FROM `catalog_items` LEFT > OUTER JOIN `markers` ON `markers`.id = `catalog_items`.marker_id LEFT OUTER > JOIN `conjugates` ON `conjugates`.id = `catalog_items`.conjugate_id LEFT > OUTER JOIN `fragments` ON `fragments`.id = `catalog_items`.fragment_id LEFT > OUTER JOIN `isotypehs` ON `isotypehs`.id = `catalog_items`.isotypeh_id LEFT > OUTER JOIN `origins` ON `origins`.id = `catalog_items`.origin_id LEFT OUTER > JOIN `manufacturers` ON `manufacturers`.id = `catalog_items`.manufacturer_id > LEFT OUTER JOIN `catalog_items_reactivities` ON > `catalog_items_reactivities`.catalog_item_id = `catalog_items`.id LEFT OUTER > JOIN `reactivities` ON `reactivities`.id = > `catalog_items_reactivities`.reactivity_id LEFT OUTER JOIN `isotypels` ON > `isotypels`.id = `catalog_items`.isotypel_id LEFT OUTER JOIN > `applications_catalog_items` ON `applications_catalog_items`.catalog_item_id = > `catalog_items`.id LEFT OUTER JOIN `applications` ON `applications`.id = > `applications_catalog_items`.application_id LEFT OUTER JOIN `catalog_items` > catalog_items_catalog_items ON catalog_items_catalog_items.catalog_item_id = > catalog_items.id WHERE (((catalog_items.id = '5'))) AND (markers.name= > "Isotype Control" AND catalog_items.conjugate_id = 1 AND > catalog_items.fragment_id = 1 AND catalog_items.isotypeh_id = 2 AND > catalog_items.origin_id = 1) ) > > 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 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.
