Add StockChanges index

This commit is contained in:
Julius 2013-07-09 21:46:04 +02:00
parent d397132f7b
commit ef62a18ac9
9 changed files with 59 additions and 1 deletions

View file

@ -99,6 +99,11 @@ 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

@ -0,0 +1,8 @@
#encoding: utf-8
class StockChangesController < ApplicationController
before_filter :find_stock_article
def index
@stock_changes = @stock_article.stock_changes(:readonly => true).order('stock_changes.created_at DESC')
end
end