Skip to content

Commit

Permalink
Fixing support for external database(:some_db) contexts... before thi…
Browse files Browse the repository at this point in the history
…s patch, properties for DM models would not be set for all the db adapters, just the :default one
  • Loading branch information
Lucas Carlson committed Apr 21, 2008
1 parent 28c4a27 commit 19205a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/data_mapper/database.rb
Expand Up @@ -88,6 +88,10 @@ class DatabaseError < StandardError
# end # :second_database
class Database

def self.databases
@databases.map{|d|d[1]}
end

@databases = {}

# Allows you to access any of the named databases you have already setup.
Expand Down
2 changes: 1 addition & 1 deletion lib/data_mapper/property.rb
Expand Up @@ -159,7 +159,7 @@ def initialize(klass, name, type, options)
validate_options!
determine_visibility!

database.schema[klass].add_column(@symbolized_name, @type, @options)
Database.databases.each{|database| database.adapter.table(klass).add_column(@symbolized_name, @type, @options)}
klass::ATTRIBUTES << @symbolized_name

create_getter!
Expand Down

0 comments on commit 19205a7

Please sign in to comment.