active_record_to_simpledb 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +42 -9
- data/VERSION +1 -1
- data/active_record_to_simpledb.gemspec +1 -1
- data/lib/active_record_to_simpledb.rb +21 -0
- data/spec/active_record_to_simpledb_spec.rb +0 -5
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,16 +1,49 @@
|
|
1
1
|
= active_record_to_simpledb
|
2
2
|
|
3
|
-
|
3
|
+
Imagine you have an Active Record model like:
|
4
|
+
|
5
|
+
class TicketSale < ActiveRecord::Base
|
6
|
+
end
|
7
|
+
|
8
|
+
You can just include each of the callbacks depending on your needs:
|
9
|
+
|
10
|
+
|
11
|
+
class TicketSale < ActiveRecord::Base
|
12
|
+
include ActiveRecordToSimpledb::Callbacks::Create
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
=== not yet done, but it'll in the future
|
17
|
+
|
18
|
+
class TicketSale < ActiveRecord::Base
|
19
|
+
include ActiveRecordToSimpledb::Callbacks::Update
|
20
|
+
include ActiveRecordToSimpledb::Callbacks::Delete
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
== AWS Configuration:
|
26
|
+
|
27
|
+
We assume you have a file in /config/aws.yml that looks like:
|
28
|
+
|
29
|
+
test:
|
30
|
+
access_key_id: ''
|
31
|
+
secret_access_key: ''
|
32
|
+
|
33
|
+
production:
|
34
|
+
access_key_id: ''
|
35
|
+
secret_access_key: ''
|
36
|
+
|
37
|
+
development:
|
38
|
+
access_key_id: ''
|
39
|
+
secret_access_key: ''
|
40
|
+
|
41
|
+
|
4
42
|
|
5
43
|
== Contributing to active_record_to_simpledb
|
6
|
-
|
7
|
-
*
|
8
|
-
|
9
|
-
* Fork the project
|
10
|
-
* Start a feature/bugfix branch
|
11
|
-
* Commit and push until you are happy with your contribution
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
44
|
+
|
45
|
+
* Fork, Test, Pull Request
|
46
|
+
|
14
47
|
|
15
48
|
== Copyright
|
16
49
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -1,3 +1,24 @@
|
|
1
|
+
require 'right_aws'
|
2
|
+
require 'sdb/active_sdb'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
class AWS
|
6
|
+
def self.root
|
7
|
+
rails_root = (Rails.version < "2.1.2") ? RAILS_ROOT : Rails.root
|
8
|
+
YAML::load(IO.read(File.join(rails_root, 'config', 'aws.yml')))
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.key
|
12
|
+
AWS.root[RAILS_ENV]['access_key_id']
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.secret
|
16
|
+
AWS.root[RAILS_ENV]['secret_access_key']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
|
1
22
|
class ActiveRecordToSimpledb
|
2
23
|
|
3
24
|
# Public: It connect to aws
|
@@ -1,12 +1,7 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'right_aws'
|
3
|
-
require 'sdb/active_sdb'
|
4
1
|
require 'activerecord'
|
5
2
|
require 'active_record_setup'
|
6
3
|
require 'active_record_to_simpledb'
|
7
4
|
|
8
|
-
require 'aws'
|
9
|
-
|
10
5
|
class TicketSale < ActiveRecord::Base
|
11
6
|
include ActiveRecordToSimpledb::Callbacks::Create
|
12
7
|
end
|