foodsoft/app/controllers/stock_takings_controller.rb

28 lines
732 B
Ruby
Raw Normal View History

class StockTakingsController < ApplicationController
inherit_resources
2012-10-29 18:28:17 +01:00
def index
@stock_takings = StockTaking.order('date DESC').page(params[:page]).per(@per_page)
end
def new
@stock_taking = StockTaking.new
StockArticle.undeleted.each { |a| @stock_taking.stock_changes.build(stock_article: a) }
end
def new_on_stock_article_create # See publish/subscribe design pattern in /doc.
stock_article = StockArticle.find(params[:stock_article_id])
@stock_change = StockChange.new(stock_article: stock_article)
render layout: false
end
def create
create!(notice: I18n.t('stock_takings.create.notice'))
end
def update
update!(notice: I18n.t('stock_takings.update.notice'))
end
end