I have the following code @components_pages = Paginator.new self, Computer.find(params[:id]).components.count, 2, @params['page'] How can I restrict find to only return associations(components) for the current page? @computer = Computer.find(params[:id] ..................... I spent a few hours thinking about this one but to no avail regards, Leon.
on 2005-11-17 18:30
on 2005-11-17 20:25
I also has this problem and solved it by using conditions (accroding to the associaltions) in the paginate definition. But I i don't think this is a nice solution. Are there better ways of doing that ? regards On 11/17/05, Leon Leslie <firstname.lastname@example.org> wrote: > I spent a few hours thinking about this one but to no avail > > -- Roberto Saccon - http://rsaccon.com
on 2005-11-17 22:17
Hi Saccon, Thanks for your quick reply to the post. Do you have an example? It would be cool if one could limit includes in associations, but this is just my mad method of thinking. Can i have a view of your conditions and how you did it? regards, Leon.
on 2005-11-18 09:37
Computer.find(:first, :conditions => ["id=?", params[:id]]).components.count __________________________________________________________ or Computer.find(:first, :conditions => ["id=? and price>?", params[:id], 3000]).components.count i hope that's make sense.