Skip to content

Commit

Permalink
Add apartment basic support
Browse files Browse the repository at this point in the history
  • Loading branch information
stanguy committed Apr 11, 2013
1 parent 8b82819 commit 0d479b5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Expand Up @@ -11,6 +11,7 @@ gem 'nokogiri'
gem 'pg'
gem 'activerecord-postgis-adapter'
gem 'inherited_resources'
gem 'apartment'

gem 'jquery-rails'

Expand Down Expand Up @@ -42,5 +43,6 @@ group :development, :test do
gem 'rb-inotify', '~> 0.8.8'
gem "better_errors"
gem "binding_of_caller"
# gem 'database_cleaner'
end

4 changes: 4 additions & 0 deletions Gemfile.lock
Expand Up @@ -39,6 +39,9 @@ GEM
i18n (= 0.6.1)
multi_json (~> 1.0)
addressable (2.3.2)
apartment (0.20.0)
activerecord (>= 3.1.2)
rack (>= 1.3.6)
arel (3.0.2)
better_errors (0.7.0)
coderay (>= 1.0.0)
Expand Down Expand Up @@ -193,6 +196,7 @@ PLATFORMS

DEPENDENCIES
activerecord-postgis-adapter
apartment
better_errors
binding_of_caller
carrierwave
Expand Down
1 change: 1 addition & 0 deletions app/controllers/home_controller.rb
Expand Up @@ -296,6 +296,7 @@ def set_agency
if @agency.nil?
not_found
end
Apartment::Database.switch( @agency.slug )
else
not_found
end
Expand Down
5 changes: 5 additions & 0 deletions config/initializers/apartment.rb
@@ -0,0 +1,5 @@
Apartment.configure do |config|
config.persistent_schemas = ['postgis']
config.default_schema = "public"
config.excluded_models = ["Agency"]
end
1 change: 1 addition & 0 deletions lib/tasks/import.rake
Expand Up @@ -19,6 +19,7 @@ namespace :stargtfs do
args[:agencies].split(/:/).each do |cityname|
citysym = cityname.to_sym
if Importers.has_key? citysym
Apartment::Database.switch( cityname )
importer = Importers[citysym].new
importer.run
else
Expand Down

0 comments on commit 0d479b5

Please sign in to comment.