Skip to content

Commit

Permalink
Minor copy tweaks...
Browse files Browse the repository at this point in the history
  • Loading branch information
bullrico committed Oct 6, 2008
1 parent 13209ab commit 78dadb3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
10 changes: 7 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
Spree MultiStore Extension
# Spree MultiStore Extension
The goal is to be able to host multiple stores with one Spree app.

# Assumptions:
Individual stores are accessed like this:

http://example.com/my_store
<pre>
http://example.com/store1 and http://example.com/store2
</pre>
A partial is added to the users/new form for the store info (views use HAML/SASS)


4 changes: 2 additions & 2 deletions app/models/store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def self.find_by_host(name)
name.downcase!
name.strip!
name.sub! /^www\./, ''
sites = find :all, :conditions => ['host = ? or host = ?', name, '']
sites.reject { |s| s.default? }.first || sites.first
stores = find :all, :conditions => ['host = ? or host = ?', name, '']
stores.reject { |s| s.default? }.first || stores.first
end

def default?
Expand Down
3 changes: 1 addition & 2 deletions lib/store_system.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module StoreSystem
protected


def current_store
@current_store ||= Store.find_by_host(request.host) or raise Store::UndefinedError
end
Expand Down
6 changes: 3 additions & 3 deletions multi_store_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class MultiStoreExtension < Spree::Extension
# map.namespace :admin do |admin|
# admin.resources :whatever
# end
map.root :controller => "stores", :action => "index"
# map.root :controller => "stores", :action => "index"
map.resources :stores
end

Expand All @@ -25,8 +25,8 @@ def activate
before_filter :get_store_and_product, :only => :show

def get_store_and_products
# @store = current_store
# @products = @store.products
@store = current_store
@products = @store.products
end

def get_store_and_product
Expand Down

0 comments on commit 78dadb3

Please sign in to comment.