Skip to content

Commit

Permalink
Dry up current_currency. Fixes spree#6138
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Dutil authored and Jeff Dutil committed Mar 9, 2015
1 parent 3d15d59 commit dd044e5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
5 changes: 0 additions & 5 deletions api/app/controllers/spree/api/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ def current_ability
Spree::Ability.new(current_api_user)
end

def current_currency
Spree::Config[:currency]
end
helper_method :current_currency

def invalid_resource!(resource)
@resource = resource
render "spree/api/errors/invalid_resource", status: 422
Expand Down
5 changes: 0 additions & 5 deletions core/lib/spree/core/controller_helpers/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module Order
included do
before_filter :set_current_order

helper_method :current_currency
helper_method :current_order
helper_method :simple_current_order
end
Expand Down Expand Up @@ -64,10 +63,6 @@ def set_current_order
end
end

def current_currency
Spree::Config[:currency]
end

def ip_address
request.remote_ip
end
Expand Down
11 changes: 7 additions & 4 deletions core/lib/spree/core/controller_helpers/store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ module Store
extend ActiveSupport::Concern

included do

def current_store
@current_store ||= Spree::Store.current(request.env['SERVER_NAME'])
end
helper_method :current_currency
helper_method :current_store
end

def current_currency
Spree::Config[:currency]
end

def current_store
@current_store ||= Spree::Store.current(request.env['SERVER_NAME'])
end
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions guides/content/release_notes/3_0_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ You can view the full changes using [Github Compare](https://github.com/spree/sp

https://github.com/spree/spree/pull/6097

* Moved current_currency helper from Spree::Core::ControllerHelpers::Order to Spree::Core::ControllerHelpers::Order.

* The line items order population endpoint used to accept a hash, it now accepts an array. When submitting a Post request to `/api/line_items` you will receive this deprecation warning:

```text
Expand Down

0 comments on commit dd044e5

Please sign in to comment.