composite_primary_keys 0.7.3 → 0.7.4

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.
@@ -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
- raise CompositeKeyError, "Composite keys do not generated ids from sequences, you must provide id values"
136
- end
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
- "INSERT INTO #{self.class.table_name} " +
140
- "(#{quoted_column_names.join(', ')}) " +
141
- "VALUES(#{attributes_with_quotes.values.join(', ')})",
142
- "#{self.class.name} Create"
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 ")
@@ -2,7 +2,7 @@ module CompositePrimaryKeys
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 7
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
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.3</a>
36
+ <a href="http://rubyforge.org/projects/compositekeys" class="numbers">0.7.4</a>
37
37
  </div>
38
38
  <h2>What</h2>
39
39
 
@@ -1,3 +1,3 @@
1
1
  // Announcement JS file
2
- var version = "0.7.3";
2
+ var version = "0.7.4";
3
3
  MagicAnnouncement.show('compositekeys', version);
data/website/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // Version JS file
2
- var version = "0.7.3";
2
+ var version = "0.7.4";
3
3
 
4
4
  document.write(" - " + version);
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.3
7
- date: 2006-11-09 00:00:00 +01:00
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