Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added pre setting options before establishing connection and a rails/…

…init.rb to specify best practice rails settings.
  • Loading branch information...
commit 281be7da392feca7244cb2d9c2c749cc2c8f0995 1 parent ad259ea
@treeder treeder authored
View
2  VERSION.yml
@@ -1,5 +1,5 @@
---
:major: 1
:minor: 1
-:patch: 68
+:patch: 70
View
9 lib/simple_record.rb
@@ -39,6 +39,7 @@
module SimpleRecord
+ @@options = {}
@@stats = SimpleRecord::Stats.new
def self.stats
@@ -61,8 +62,9 @@ def self.stats
# :pool (uses a connection pool with a maximum number of connections - NOT IMPLEMENTED YET)
# :logger => Logger Object # Logger instance: logs to STDOUT if omitted
def self.establish_connection(aws_access_key=nil, aws_secret_key=nil, params={})
- @@options = params
- Aws::ActiveSdb.establish_connection(aws_access_key, aws_secret_key, params)
+ @@options.merge!(params)
+ puts 'SimpleRecord.establish_connection with ' + @@options.inspect
+ Aws::ActiveSdb.establish_connection(aws_access_key, aws_secret_key, @@options)
end
def self.close_connection()
@@ -73,6 +75,7 @@ def self.options
@@options
end
+
class Base < Aws::ActiveSdb::Base
include SimpleRecord::Translations
@@ -177,7 +180,7 @@ def domain
def self.domain
#return self.get_domain_name unless self.get_domain_name.nil?
d = super
- puts 'in self.domain, d=' + d.to_s + ' domain_prefix=' + SimpleRecord::Base.domain_prefix.to_s
+# puts 'in self.domain, d=' + d.to_s + ' domain_prefix=' + SimpleRecord::Base.domain_prefix.to_s
domain_name_for_class = (SimpleRecord::Base.domain_prefix || "") + d.to_s
#self.set_domain_name(domain_name_for_class)
domain_name_for_class
View
12 rails/init.rb
@@ -0,0 +1,12 @@
+# This will help setup for easier setup in Rails apps.
+
+puts 'SimpleRecord rails/init.rb...'
+SimpleRecord.options[:connection_mode] = :per_thread
+
+::ApplicationController.class_eval do
+ def close_sdb_connection
+ puts "Closing sdb connection."
+ SimpleRecord.close_connection
+ end
+end
+::ApplicationController.send :after_filter, :close_sdb_connection
View
9 simple_record.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{simple_record}
- s.version = "1.1.67"
+ s.version = "1.1.69"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Travis Reeder", "Chad Arimura", "RightScale"]
- s.date = %q{2010-01-23}
+ s.date = %q{2010-03-09}
s.description = %q{Drop in replacement for ActiveRecord to Amazon SimpleDB instead.}
s.email = %q{travis@appoxy.com}
s.extra_rdoc_files = [
@@ -29,11 +29,10 @@ Gem::Specification.new do |s|
s.homepage = %q{http://github.com/appoxy/simple_record/}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.5}
+ s.rubygems_version = %q{1.3.6}
s.summary = %q{Drop in replacement for ActiveRecord to Amazon SimpleDB instead.}
s.test_files = [
"test/conversions.rb",
- "test/test_dirty.rb",
"test/model_with_enc.rb",
"test/my_base_model.rb",
"test/my_child_model.rb",
@@ -41,6 +40,8 @@ Gem::Specification.new do |s|
"test/paging_array_test.rb",
"test/temp_test.rb",
"test/test_base.rb",
+ "test/test_dirty.rb",
+ "test/test_global_options.rb",
"test/test_helpers.rb",
"test/test_results_array.rb",
"test/test_simple_record.rb"
Please sign in to comment.
Something went wrong with that request. Please try again.