Derek Haynes
2005-Sep-15 17:07 UTC
ActiveRecord::ConfigurationError (You can not use offset and limit together...)
All, I''m trying to retrieve a limited collection of ActiveRecord objects but I am running into the following error: ActiveRecord::ConfigurationError (You can not use offset and limit together with has_many or has_and_belongs_to_many associations) The application has a User model and an Item model which have a has_and_belongs_to_many association. I am attempting to find all items owned by users that live in a specified country. Item.find(:all, :conditions => ["users.home_country_id = ?",location.id], :include => :users, :limit => 5 ) I''ve also attempted to replace "limit" with "offset" but the same error message appears. Also, I can''t find "offset" or "limit" in the SQL statement generated by Rails. Any ideas on how to get around this limitation other than retrieving all the records and slicing the result? Thanks, Derek -- Derek Haynes HighGroove Studios - http://www.highgroove.com Keeping it Simple. 404.593.4879