So basically I have this for my index page:
def index
@articles = Article.paginate(:per_page => 15, :page => params[:page])
end
I implemented soft deletion, which basically works like this: there is an additional boolean column in db that is called is_active and is true by default. Deleting is rewritten to just change that to false instead of destruction, and made a page to view soft-deleted entries.
The issue: current workaround I found for paginate is to simply add
<% if article.is_active %>
in my index.html.erb. The flaw is: when I delete something it still considered there by paginate, so instead of say 15 entries I will see 14. Even worse, on undeleting page it shows same amount of blank pages, and deleted entries are on their would-be-appropriate pages (so for example first entry may end up being on page 14 instead of 1). It is not critical flaw, but I'd like to know if I can fix it without rewriting too much.
Maybe I can change something in controller so it doesn't send any entries that have true or false in that field depending on what I want to output?