Inline before_filter of stock_changes_controller
This commit is contained in:
parent
620686fa46
commit
edaf91b029
2 changed files with 1 additions and 6 deletions
|
@ -99,11 +99,6 @@ class ApplicationController < ActionController::Base
|
||||||
@supplier = Supplier.find(params[:supplier_id]) if params[:supplier_id]
|
@supplier = Supplier.find(params[:supplier_id]) if params[:supplier_id]
|
||||||
end
|
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
|
# Set config and database connection for each request
|
||||||
# It uses the subdomain to select the appropriate section in the config files
|
# It uses the subdomain to select the appropriate section in the config files
|
||||||
# Use this method as a before filter (first filter!) in ApplicationController
|
# Use this method as a before filter (first filter!) in ApplicationController
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#encoding: utf-8
|
#encoding: utf-8
|
||||||
class StockChangesController < ApplicationController
|
class StockChangesController < ApplicationController
|
||||||
before_filter :find_stock_article
|
|
||||||
|
|
||||||
def index
|
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!}
|
@stock_changes = @stock_article.stock_changes.order('stock_changes.created_at DESC').each {|s| s.readonly!}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue