Skip to content

Commit

Permalink
fixed saberma#393, recently products which contain deleted products s…
Browse files Browse the repository at this point in the history
…hould be show.
  • Loading branch information
saberma committed Jan 13, 2012
1 parent da2c0d3 commit f9cdd92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/shop/products_controller.rb
Expand Up @@ -14,7 +14,9 @@ def show
render text: html
}
format.js {
render json: product.shop_as_json
product = shop.products.where(handle: params[:handle]).first
json = product ? product.shop_as_json : {}
render json: json
}
end
end
Expand Down
9 changes: 9 additions & 0 deletions spec/controllers/shop/products_controller_spec.rb
Expand Up @@ -68,6 +68,15 @@
response.status.should eql 404
end

context 'js' do # 通过js访问时,返回空json,否则会导致[最近浏览列表]无法显示

it "should be success" do
get 'show', handle: 'no-exists-handle', format: :js
response.status.should eql 200
end

end

end

end

0 comments on commit f9cdd92

Please sign in to comment.