Inline before_filter of stock_changes_controller

This commit is contained in:
Julius 2013-07-12 22:19:11 +02:00
parent 620686fa46
commit edaf91b029
2 changed files with 1 additions and 6 deletions

View File

@ -99,11 +99,6 @@ class ApplicationController < ActionController::Base
@supplier = Supplier.find(params[:supplier_id]) if params[:supplier_id]
end
# Get stock_article in nested resources
def find_stock_article
@stock_article = StockArticle.undeleted.find(params[:stock_article_id])
end
# Set config and database connection for each request
# It uses the subdomain to select the appropriate section in the config files
# Use this method as a before filter (first filter!) in ApplicationController

View File

@ -1,8 +1,8 @@
#encoding: utf-8
class StockChangesController < ApplicationController
before_filter :find_stock_article
def index
@stock_article = StockArticle.undeleted.find(params[:stock_article_id])
@stock_changes = @stock_article.stock_changes.order('stock_changes.created_at DESC').each {|s| s.readonly!}
end
end