Hi Guys, In my application I created this method: def self.find_paginated_posts_by_post_type(post_type,page=1,query="") if query.empty? == false query = "%#{query}%" else query = "%" end result = includes(:user). where(['post_type_id = ? AND title LIKE ?', post_type.id, query]). order('created_at DESC'). page(page) return result end
this method is returning an ActiveRecord::Relation Object. So, when I use will_paginate method my application throws an exception : undefined method `total_pages' for #<ActiveRecord::Relation:0x007f94581e7848> How can I fix it? Thx Bruno Meira -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.