Changed behaviour of acts_as_paraniod. Finder wrapper removed an replaced by simple named_scope 'without_deleted'.

This commit is contained in:
Benjamin Meichsner 2009-02-11 15:23:59 +01:00
parent cd9636a650
commit 325d47b22f
18 changed files with 218 additions and 136 deletions

View file

@ -28,12 +28,14 @@ class ArticlesController < ApplicationController
# if somebody uses the search field:
conditions = ["articles.name LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
@total = @supplier.articles.count(:conditions => conditions)
@articles = @supplier.articles.paginate(:order => sort,
:conditions => conditions,
:page => params[:page],
:per_page => @per_page,
:include => :article_category)
@total = @supplier.articles.without_deleted.count(:conditions => conditions)
@articles = @supplier.articles.without_deleted.paginate(
:order => sort,
:conditions => conditions,
:page => params[:page],
:per_page => @per_page,
:include => :article_category
)
respond_to do |format|
format.html # list.haml
@ -136,7 +138,7 @@ class ArticlesController < ApplicationController
# Renders a form for editing all articles from a supplier
def edit_all
@articles = @supplier.articles.all
@articles = @supplier.articles.without_deleted
end
# Updates all article of specific supplier