Class: StockTakingsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/stock_takings_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

current

Methods included from PathHelper

#finance_group_transactions_path

Instance Method Details

#createObject



22
23
24
# File 'app/controllers/stock_takings_controller.rb', line 22

def create
  create!(notice: I18n.t('stock_takings.create.notice'))
end

#indexObject



4
5
6
# File 'app/controllers/stock_takings_controller.rb', line 4

def index
  @stock_takings = StockTaking.order('date DESC').page(params[:page]).per(@per_page)
end

#newObject



8
9
10
11
12
13
# File 'app/controllers/stock_takings_controller.rb', line 8

def new
  @stock_taking = StockTaking.new
  StockArticle.with_latest_versions_and_categories.undeleted.each do |a|
    @stock_taking.stock_changes.build(stock_article: a)
  end
end

#new_on_stock_article_createObject

See publish/subscribe design pattern in /doc.



15
16
17
18
19
20
# File 'app/controllers/stock_takings_controller.rb', line 15

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

#updateObject



26
27
28
# File 'app/controllers/stock_takings_controller.rb', line 26

def update
  update!(notice: I18n.t('stock_takings.update.notice'))
end