Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select current store using a standard Config preference #1993

Merged
merged 4 commits into from
Jun 7, 2017

Conversation

kennyadsl
Copy link
Member

This is a first step in the attempt of reducing the queries made at each request in a default solidus store that doesn't use multiple stores, as for #1971 .

The goal here is to:

  1. make it more standard/easier to use another class to determine which store to use (this PR)
  2. move out of core the logic that checks requests info to determine if another store has to be used. This will be moved to solidus_multi_domain.
  3. just use the Spree::Store.default on a solidus store without solidus_multi_domain avoiding multiple queries for each request.

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really like that change

@mtomov
Copy link
Contributor

mtomov commented Jun 6, 2017

That's just great! I always end up overriding Store.current to avoid the pesky lookups on every request:

  # class memoize it as we only have one store
  def self.current(domain = nil)
    @current_store ||= Spree::Store.default
  end

@mamhoff
Copy link
Contributor

mamhoff commented Jun 6, 2017

@kennyadsl would you mind rebasing this on the current master? The changelog changed again. :)

kennyadsl added 4 commits June 6, 2017 17:34
It basically duplicates Spree::Core::CurrentStore with the goal
of replace it with next commits.
This commit also changes Spree::Core::CurrentStore so that it
uses the new Spree::CurrentStoreSelector class.
It was previously set as a class attribute into controllers. We can
just use our default way to define preferences allowing an easier and
more standard customization.
@kennyadsl kennyadsl force-pushed the store-selector-preference branch from e327549 to 91b5f8c Compare June 6, 2017 15:35
@kennyadsl
Copy link
Member Author

@mamhoff sure, done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants