bonobos/spree-multi-domain — pull request #1 by jordan-brough (2014-05-02 18:30:38+00:00)
Title: fix for api controllers without layouts

In spree-backend we include MultiDomainHelpers into the Api BaseController [here](https://github.com/bonobos/spree-backend/blob/dcc413c/app/controllers/api/base_controller_decorator.rb#L4).
That causes [this line](https://github.com/spree/spree-multi-domain/blob/64238a7/lib/spree_multi_domain/engine.rb#L25) to start returning true for Api controllers.
Then the call to `layout.call.gsub...` on the [following line](https://github.com/spree/spree-multi-domain/blob/64238a7/lib/spree_multi_domain/engine.rb#L26) blows up because "layout.call" is nil for Api controllers.

Also, I refactored the method a bit to avoid calling "find_layout_without_multi_store" twice with the same arguments in some scenarios when there's a true ActionView::MissingTemplate error.