upgrade refactor

This commit is contained in:
2016-06-02 14:40:30 +02:00
parent 1acd200408
commit eb368a31ca
25 changed files with 36 additions and 30 deletions
+1 -1
View File
@@ -22,6 +22,7 @@ class NewSuppliersController < ApplicationController
sign_in @new_supplier.employee
if @new_supplier.employee.suppliers.size < 2
session[:supplier_id] = @new_supplier.employee.suppliers.first.try(:id)
redirect_to supplier_root_path
else
render "choose_supplier"
end
@@ -29,7 +30,6 @@ class NewSuppliersController < ApplicationController
else
save_new_supplier
end
end
def choose_supplier
@@ -12,7 +12,7 @@ module Suppliers
rescue_from CanCan::AccessDenied do |exception|
respond_to do |format|
format.html { redirect_to root_path, alert: 'Action forbidden'}
format.json { render json: {}, status: :forbidden }
format.json { render json: {errors: "403 Forbidden"}, status: :forbidden }
end
end
@@ -1,6 +1,6 @@
module Suppliers
class PagesController < Suppliers::ApplicationController
prepend_before_action :find_page, only: [:show]
before_action :find_page, only: [:show]
def index
@pages = Page.all_for_suppliers(locale: params[:locale])
render json: @pages