composite_primary_keys 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/composite_primary_keys/base.rb +9 -8
- data/lib/composite_primary_keys/version.rb +1 -1
- data/website/index.html +1 -1
- data/website/version-raw.js +1 -1
- data/website/version.js +1 -1
- metadata +2 -2
@@ -131,20 +131,21 @@ module CompositePrimaryKeys
|
|
131
131
|
|
132
132
|
# Creates a new record with values matching those of the instance attributes.
|
133
133
|
def create_without_callbacks
|
134
|
-
unless self.id
|
135
|
-
|
136
|
-
|
137
|
-
|
134
|
+
unless self.id; raise CompositeKeyError, "Composite keys do not generated ids from sequences, you must provide id values"; end
|
135
|
+
attributes_minus_pks = attributes_with_quotes(false)
|
136
|
+
cols = quoted_column_names(attributes_minus_pks) << self.class.primary_key
|
137
|
+
vals = attributes_minus_pks.values << quoted_id
|
138
138
|
connection.insert(
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
139
|
+
"INSERT INTO #{self.class.table_name} " +
|
140
|
+
"(#{cols.join(', ')}) " +
|
141
|
+
"VALUES(#{vals.join(', ')})",
|
142
|
+
"#{self.class.name} Create"
|
143
143
|
)
|
144
144
|
@new_record = false
|
145
145
|
return true
|
146
146
|
end
|
147
147
|
|
148
|
+
|
148
149
|
# Updates the associated record with values matching those of the instance attributes.
|
149
150
|
def update_without_callbacks
|
150
151
|
where_class = [self.class.primary_key, quoted_id].transpose.map {|pair| "(#{pair[0]} = #{pair[1]})"}.join(" AND ")
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>Composite Primary Keys for Ruby on Rails/ActiveRecords</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/compositekeys"; return false'>
|
35
35
|
Get Version
|
36
|
-
<a href="http://rubyforge.org/projects/compositekeys" class="numbers">0.7.
|
36
|
+
<a href="http://rubyforge.org/projects/compositekeys" class="numbers">0.7.4</a>
|
37
37
|
</div>
|
38
38
|
<h2>What</h2>
|
39
39
|
|
data/website/version-raw.js
CHANGED
data/website/version.js
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: composite_primary_keys
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.7.
|
7
|
-
date: 2006-11-
|
6
|
+
version: 0.7.4
|
7
|
+
date: 2006-11-10 00:00:00 +01:00
|
8
8
|
summary: Support for composite primary keys in ActiveRecords
|
9
9
|
require_paths:
|
10
10
|
- lib
|