Class: ActiveRecord::Base

Inherits:
Object show all
Defined in:
lib/active_record/connection_adapters/simpledb_adapter/base.rb

Direct Known Subclasses

Generators::ModelGenerator

Constant Summary collapse

DEFAULT_COLLECTION_COLUMN_NAME =
"collection".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.batch(&block) ⇒ Object



33
34
35
36
37
# File 'lib/active_record/connection_adapters/simpledb_adapter/base.rb', line 33

def self.batch &block
  connection.begin_batch
  block.call
  connection.commit_batch
end

.columns_definition(options = {}) {|table_definition| ... } ⇒ Object

Yields:

  • (table_definition)


24
25
26
27
28
29
30
31
# File 'lib/active_record/connection_adapters/simpledb_adapter/base.rb', line 24

def self.columns_definition options = {}
  table_definition = ConnectionAdapters::SimpleDbTableDifinition.new(options[:collection_column_name] || DEFAULT_COLLECTION_COLUMN_NAME)
  table_definition.primary_key(Base.get_primary_key(table_name.to_s.singularize))

  yield table_definition if block_given?

  ConnectionAdapters::SimpleDBAdapter.set_collection_columns table_name, table_definition
end

.simpledb_connection(config) ⇒ Object

:nodoc:



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/active_record/connection_adapters/simpledb_adapter/base.rb', line 4

def self.simpledb_connection(config) # :nodoc:

  config = config.symbolize_keys

  ConnectionAdapters::SimpleDBAdapter.new nil, logger,
      config[:access_key_id],
      config[:secret_access_key],
      config[:domain_name],
      {
          :server => config[:host],
          :port => config[:port],
          :protocol => config[:protocol],
          :connection_mode => :per_thread,
          :logger => SimpleDBLogger.new(logger)
      },
      config
end

Instance Method Details

#quoted_idObject

disable quoting for id



40
41
42
# File 'lib/active_record/connection_adapters/simpledb_adapter/base.rb', line 40

def quoted_id
  id
end