Make the products controller specs green
This commit is contained in:
@@ -125,9 +125,9 @@ private
|
||||
end
|
||||
alias json_notice js_notice
|
||||
|
||||
def show_404(options = {})
|
||||
def show_404(error)
|
||||
respond_to do |format|
|
||||
format.html { render 'dashboard/404', options.reverse_merge(layout: true, status: 404)}
|
||||
format.html { render 'dashboard/404', {layout: true, status: 404} }
|
||||
format.json { render json: {ok: false}, status: 404 }
|
||||
end
|
||||
end
|
||||
@@ -138,7 +138,7 @@ private
|
||||
if obj.is_a?(SimplyStored::Couch)
|
||||
if obj.errors.present?
|
||||
#json_api_errors = obj.errors.details.map{|key, ers| {id: key, status: '422', title: ers.map{|e| e[:error].to_s}.join(', '), source: {parameter: key}}}
|
||||
json_api_errors = obj.errors.map{|error| {id: error.attribute, status: '422', title: error.message}}
|
||||
json_api_errors = obj.errors.map{|error| {id: error.attribute.to_s, status: '422', title: error.message}}
|
||||
options.reverse_merge(json: {errors: json_api_errors, ok: false}, status: :unprocessable_entity)
|
||||
else
|
||||
options.reverse_merge(json: obj)
|
||||
|
||||
@@ -19,7 +19,6 @@ module Suppliers
|
||||
# GET /products/1
|
||||
# GET /products/1.json
|
||||
def show
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @product }
|
||||
|
||||
Reference in New Issue
Block a user