activerecord 3.1.12 → 3.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- data/CHANGELOG.md +6263 -103
- data/README.rdoc +2 -2
- data/examples/performance.rb +55 -31
- data/lib/active_record.rb +28 -2
- data/lib/active_record/aggregations.rb +2 -2
- data/lib/active_record/associations.rb +82 -69
- data/lib/active_record/associations/association.rb +2 -37
- data/lib/active_record/associations/association_scope.rb +3 -30
- data/lib/active_record/associations/builder/association.rb +6 -4
- data/lib/active_record/associations/builder/belongs_to.rb +3 -3
- data/lib/active_record/associations/builder/collection_association.rb +2 -2
- data/lib/active_record/associations/builder/has_many.rb +4 -4
- data/lib/active_record/associations/builder/has_one.rb +5 -6
- data/lib/active_record/associations/builder/singular_association.rb +3 -16
- data/lib/active_record/associations/collection_association.rb +55 -28
- data/lib/active_record/associations/collection_proxy.rb +1 -35
- data/lib/active_record/associations/has_many_association.rb +5 -1
- data/lib/active_record/associations/has_many_through_association.rb +11 -8
- data/lib/active_record/associations/join_dependency.rb +1 -1
- data/lib/active_record/associations/preloader/association.rb +3 -1
- data/lib/active_record/attribute_assignment.rb +221 -0
- data/lib/active_record/attribute_methods.rb +212 -32
- data/lib/active_record/attribute_methods/deprecated_underscore_read.rb +32 -0
- data/lib/active_record/attribute_methods/dirty.rb +3 -3
- data/lib/active_record/attribute_methods/primary_key.rb +62 -25
- data/lib/active_record/attribute_methods/read.rb +69 -80
- data/lib/active_record/attribute_methods/serialization.rb +89 -0
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +9 -14
- data/lib/active_record/attribute_methods/write.rb +27 -5
- data/lib/active_record/autosave_association.rb +23 -8
- data/lib/active_record/base.rb +223 -1712
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +98 -132
- data/lib/active_record/connection_adapters/abstract/connection_specification.rb +82 -29
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +13 -42
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +1 -1
- data/lib/active_record/connection_adapters/abstract/quoting.rb +7 -4
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +36 -25
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +41 -13
- data/lib/active_record/connection_adapters/abstract_adapter.rb +78 -43
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +653 -0
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +138 -578
- data/lib/active_record/connection_adapters/mysql_adapter.rb +86 -658
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +144 -94
- data/lib/active_record/connection_adapters/schema_cache.rb +50 -0
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +2 -6
- data/lib/active_record/connection_adapters/sqlite_adapter.rb +43 -22
- data/lib/active_record/counter_cache.rb +1 -1
- data/lib/active_record/dynamic_matchers.rb +79 -0
- data/lib/active_record/errors.rb +11 -1
- data/lib/active_record/explain.rb +83 -0
- data/lib/active_record/explain_subscriber.rb +21 -0
- data/lib/active_record/fixtures.rb +31 -76
- data/lib/active_record/fixtures/file.rb +65 -0
- data/lib/active_record/identity_map.rb +1 -7
- data/lib/active_record/inheritance.rb +167 -0
- data/lib/active_record/integration.rb +49 -0
- data/lib/active_record/locking/optimistic.rb +19 -11
- data/lib/active_record/locking/pessimistic.rb +1 -1
- data/lib/active_record/log_subscriber.rb +3 -3
- data/lib/active_record/migration.rb +38 -29
- data/lib/active_record/migration/command_recorder.rb +7 -7
- data/lib/active_record/model_schema.rb +362 -0
- data/lib/active_record/nested_attributes.rb +3 -2
- data/lib/active_record/persistence.rb +51 -1
- data/lib/active_record/querying.rb +58 -0
- data/lib/active_record/railtie.rb +24 -28
- data/lib/active_record/railties/controller_runtime.rb +3 -1
- data/lib/active_record/railties/databases.rake +133 -77
- data/lib/active_record/readonly_attributes.rb +26 -0
- data/lib/active_record/reflection.rb +7 -15
- data/lib/active_record/relation.rb +78 -35
- data/lib/active_record/relation/batches.rb +5 -2
- data/lib/active_record/relation/calculations.rb +27 -6
- data/lib/active_record/relation/delegation.rb +49 -0
- data/lib/active_record/relation/finder_methods.rb +5 -4
- data/lib/active_record/relation/predicate_builder.rb +13 -16
- data/lib/active_record/relation/query_methods.rb +59 -4
- data/lib/active_record/result.rb +1 -1
- data/lib/active_record/sanitization.rb +194 -0
- data/lib/active_record/schema_dumper.rb +5 -2
- data/lib/active_record/scoping.rb +152 -0
- data/lib/active_record/scoping/default.rb +140 -0
- data/lib/active_record/scoping/named.rb +202 -0
- data/lib/active_record/serialization.rb +1 -43
- data/lib/active_record/serializers/xml_serializer.rb +2 -44
- data/lib/active_record/session_store.rb +11 -11
- data/lib/active_record/store.rb +50 -0
- data/lib/active_record/test_case.rb +11 -7
- data/lib/active_record/timestamp.rb +16 -3
- data/lib/active_record/transactions.rb +5 -5
- data/lib/active_record/translation.rb +22 -0
- data/lib/active_record/validations.rb +1 -1
- data/lib/active_record/validations/associated.rb +5 -4
- data/lib/active_record/validations/uniqueness.rb +4 -4
- data/lib/active_record/version.rb +3 -3
- data/lib/rails/generators/active_record/session_migration/templates/migration.rb +1 -5
- metadata +48 -38
- checksums.yaml +0 -7
- data/lib/active_record/named_scope.rb +0 -200
@@ -1,7 +1,7 @@
|
|
1
1
|
module ActiveRecord
|
2
2
|
# = Active Record Session Store
|
3
3
|
#
|
4
|
-
# A session store backed by an Active Record class.
|
4
|
+
# A session store backed by an Active Record class. A default class is
|
5
5
|
# provided, but any object duck-typing to an Active Record Session class
|
6
6
|
# with text +session_id+ and +data+ attributes is sufficient.
|
7
7
|
#
|
@@ -23,7 +23,7 @@ module ActiveRecord
|
|
23
23
|
# ActiveRecord::SessionStore::Session.data_column_name = 'legacy_session_data'
|
24
24
|
#
|
25
25
|
# Note that setting the primary key to the +session_id+ frees you from
|
26
|
-
# having a separate +id+ column if you don't want it.
|
26
|
+
# having a separate +id+ column if you don't want it. However, you must
|
27
27
|
# set <tt>session.model.id = session.session_id</tt> by hand! A before filter
|
28
28
|
# on ApplicationController is a good place.
|
29
29
|
#
|
@@ -46,7 +46,7 @@ module ActiveRecord
|
|
46
46
|
# save
|
47
47
|
# destroy
|
48
48
|
#
|
49
|
-
# The example SqlBypass class is a generic SQL session store.
|
49
|
+
# The example SqlBypass class is a generic SQL session store. You may
|
50
50
|
# use it as a basis for high-performance database-specific stores.
|
51
51
|
class SessionStore < ActionDispatch::Session::AbstractStore
|
52
52
|
module ClassMethods # :nodoc:
|
@@ -59,12 +59,12 @@ module ActiveRecord
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def drop_table!
|
62
|
-
|
62
|
+
connection.schema_cache.clear_table_cache!(table_name)
|
63
63
|
connection.drop_table table_name
|
64
64
|
end
|
65
65
|
|
66
66
|
def create_table!
|
67
|
-
|
67
|
+
connection.schema_cache.clear_table_cache!(table_name)
|
68
68
|
connection.create_table(table_name) do |t|
|
69
69
|
t.string session_id_column, :limit => 255
|
70
70
|
t.text data_column_name
|
@@ -79,7 +79,7 @@ module ActiveRecord
|
|
79
79
|
|
80
80
|
##
|
81
81
|
# :singleton-method:
|
82
|
-
# Customizable data column name.
|
82
|
+
# Customizable data column name. Defaults to 'data'.
|
83
83
|
cattr_accessor :data_column_name
|
84
84
|
self.data_column_name = 'data'
|
85
85
|
|
@@ -161,12 +161,12 @@ module ActiveRecord
|
|
161
161
|
end
|
162
162
|
|
163
163
|
# A barebones session store which duck-types with the default session
|
164
|
-
# store but bypasses Active Record and issues SQL directly.
|
164
|
+
# store but bypasses Active Record and issues SQL directly. This is
|
165
165
|
# an example session model class meant as a basis for your own classes.
|
166
166
|
#
|
167
167
|
# The database connection, table name, and session id and data columns
|
168
|
-
# are configurable class attributes.
|
169
|
-
# are implemented as class methods that you may override.
|
168
|
+
# are configurable class attributes. Marshaling and unmarshaling
|
169
|
+
# are implemented as class methods that you may override. By default,
|
170
170
|
# marshaling data is
|
171
171
|
#
|
172
172
|
# ActiveSupport::Base64.encode64(Marshal.dump(data))
|
@@ -176,7 +176,7 @@ module ActiveRecord
|
|
176
176
|
# Marshal.load(ActiveSupport::Base64.decode64(data))
|
177
177
|
#
|
178
178
|
# This marshaling behavior is intended to store the widest range of
|
179
|
-
# binary session data in a +text+ column.
|
179
|
+
# binary session data in a +text+ column. For higher performance,
|
180
180
|
# store in a +blob+ column instead and forgo the Base64 encoding.
|
181
181
|
class SqlBypass
|
182
182
|
extend ClassMethods
|
@@ -292,7 +292,7 @@ module ActiveRecord
|
|
292
292
|
end
|
293
293
|
end
|
294
294
|
|
295
|
-
# The class used for session storage.
|
295
|
+
# The class used for session storage. Defaults to
|
296
296
|
# ActiveRecord::SessionStore::Session
|
297
297
|
cattr_accessor :session_class
|
298
298
|
self.session_class = Session
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
# Store gives you a thin wrapper around serialize for the purpose of storing hashes in a single column.
|
3
|
+
# It's like a simple key/value store backed into your record when you don't care about being able to
|
4
|
+
# query that store outside the context of a single record.
|
5
|
+
#
|
6
|
+
# You can then declare accessors to this store that are then accessible just like any other attribute
|
7
|
+
# of the model. This is very helpful for easily exposing store keys to a form or elsewhere that's
|
8
|
+
# already built around just accessing attributes on the model.
|
9
|
+
#
|
10
|
+
# Make sure that you declare the database column used for the serialized store as a text, so there's
|
11
|
+
# plenty of room.
|
12
|
+
#
|
13
|
+
# Examples:
|
14
|
+
#
|
15
|
+
# class User < ActiveRecord::Base
|
16
|
+
# store :settings, accessors: [ :color, :homepage ]
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# u = User.new(color: 'black', homepage: '37signals.com')
|
20
|
+
# u.color # Accessor stored attribute
|
21
|
+
# u.settings[:country] = 'Denmark' # Any attribute, even if not specified with an accessor
|
22
|
+
#
|
23
|
+
# # Add additional accessors to an existing store through store_accessor
|
24
|
+
# class SuperUser < User
|
25
|
+
# store_accessor :settings, :privileges, :servants
|
26
|
+
# end
|
27
|
+
module Store
|
28
|
+
extend ActiveSupport::Concern
|
29
|
+
|
30
|
+
module ClassMethods
|
31
|
+
def store(store_attribute, options = {})
|
32
|
+
serialize store_attribute, Hash
|
33
|
+
store_accessor(store_attribute, options[:accessors]) if options.has_key? :accessors
|
34
|
+
end
|
35
|
+
|
36
|
+
def store_accessor(store_attribute, *keys)
|
37
|
+
Array(keys).flatten.each do |key|
|
38
|
+
define_method("#{key}=") do |value|
|
39
|
+
send(store_attribute)[key] = value
|
40
|
+
send("#{store_attribute}_will_change!")
|
41
|
+
end
|
42
|
+
|
43
|
+
define_method(key) do
|
44
|
+
send(store_attribute)[key]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -13,7 +13,7 @@ module ActiveRecord
|
|
13
13
|
ActiveRecord::IdentityMap.clear
|
14
14
|
end
|
15
15
|
|
16
|
-
# Backport skip to Ruby 1.8.
|
16
|
+
# Backport skip to Ruby 1.8. test/unit doesn't support it, so just
|
17
17
|
# make it a noop.
|
18
18
|
unless instance_methods.map(&:to_s).include?("skip")
|
19
19
|
def skip(message)
|
@@ -31,26 +31,30 @@ module ActiveRecord
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def assert_sql(*patterns_to_match)
|
34
|
-
|
34
|
+
ActiveRecord::SQLCounter.log = []
|
35
35
|
yield
|
36
|
-
|
36
|
+
ActiveRecord::SQLCounter.log
|
37
37
|
ensure
|
38
38
|
failed_patterns = []
|
39
39
|
patterns_to_match.each do |pattern|
|
40
|
-
failed_patterns << pattern unless
|
40
|
+
failed_patterns << pattern unless ActiveRecord::SQLCounter.log.any?{ |sql| pattern === sql }
|
41
41
|
end
|
42
|
-
assert failed_patterns.empty?, "Query pattern(s) #{failed_patterns.map{ |p| p.inspect }.join(', ')} not found.#{
|
42
|
+
assert failed_patterns.empty?, "Query pattern(s) #{failed_patterns.map{ |p| p.inspect }.join(', ')} not found.#{ActiveRecord::SQLCounter.log.size == 0 ? '' : "\nQueries:\n#{ActiveRecord::SQLCounter.log.join("\n")}"}"
|
43
43
|
end
|
44
44
|
|
45
45
|
def assert_queries(num = 1)
|
46
|
-
|
46
|
+
ActiveRecord::SQLCounter.log = []
|
47
47
|
yield
|
48
48
|
ensure
|
49
|
-
assert_equal num,
|
49
|
+
assert_equal num, ActiveRecord::SQLCounter.log.size, "#{ActiveRecord::SQLCounter.log.size} instead of #{num} queries were executed.#{ActiveRecord::SQLCounter.log.size == 0 ? '' : "\nQueries:\n#{ActiveRecord::SQLCounter.log.join("\n")}"}"
|
50
50
|
end
|
51
51
|
|
52
52
|
def assert_no_queries(&block)
|
53
|
+
prev_ignored_sql = ActiveRecord::SQLCounter.ignored_sql
|
54
|
+
ActiveRecord::SQLCounter.ignored_sql = []
|
53
55
|
assert_queries(0, &block)
|
56
|
+
ensure
|
57
|
+
ActiveRecord::SQLCounter.ignored_sql = prev_ignored_sql
|
54
58
|
end
|
55
59
|
|
56
60
|
def with_kcode(kcode)
|
@@ -33,10 +33,14 @@ module ActiveRecord
|
|
33
33
|
extend ActiveSupport::Concern
|
34
34
|
|
35
35
|
included do
|
36
|
-
class_attribute :record_timestamps
|
36
|
+
class_attribute :record_timestamps
|
37
37
|
self.record_timestamps = true
|
38
38
|
end
|
39
39
|
|
40
|
+
def initialize_dup(other)
|
41
|
+
clear_timestamp_attributes
|
42
|
+
end
|
43
|
+
|
40
44
|
private
|
41
45
|
|
42
46
|
def create #:nodoc:
|
@@ -44,7 +48,9 @@ module ActiveRecord
|
|
44
48
|
current_time = current_time_from_proper_timezone
|
45
49
|
|
46
50
|
all_timestamp_attributes.each do |column|
|
47
|
-
|
51
|
+
if respond_to?(column) && respond_to?("#{column}=") && self.send(column).nil?
|
52
|
+
write_attribute(column.to_s, current_time)
|
53
|
+
end
|
48
54
|
end
|
49
55
|
end
|
50
56
|
|
@@ -95,6 +101,13 @@ module ActiveRecord
|
|
95
101
|
def current_time_from_proper_timezone #:nodoc:
|
96
102
|
self.class.default_timezone == :utc ? Time.now.utc : Time.now
|
97
103
|
end
|
104
|
+
|
105
|
+
# Clear attributes and changed_attributes
|
106
|
+
def clear_timestamp_attributes
|
107
|
+
all_timestamp_attributes_in_model.each do |attribute_name|
|
108
|
+
self[attribute_name] = nil
|
109
|
+
changed_attributes.delete(attribute_name)
|
110
|
+
end
|
111
|
+
end
|
98
112
|
end
|
99
113
|
end
|
100
|
-
|
@@ -301,7 +301,7 @@ module ActiveRecord
|
|
301
301
|
protected
|
302
302
|
|
303
303
|
# Save the new record state and id of a record so it can be restored later if a transaction fails.
|
304
|
-
def remember_transaction_record_state #:nodoc
|
304
|
+
def remember_transaction_record_state #:nodoc:
|
305
305
|
@_start_transaction_state ||= {}
|
306
306
|
@_start_transaction_state[:id] = id if has_attribute?(self.class.primary_key)
|
307
307
|
unless @_start_transaction_state.include?(:new_record)
|
@@ -314,7 +314,7 @@ module ActiveRecord
|
|
314
314
|
end
|
315
315
|
|
316
316
|
# Clear the new record state and id of a record.
|
317
|
-
def clear_transaction_record_state #:nodoc
|
317
|
+
def clear_transaction_record_state #:nodoc:
|
318
318
|
if defined?(@_start_transaction_state)
|
319
319
|
@_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1
|
320
320
|
remove_instance_variable(:@_start_transaction_state) if @_start_transaction_state[:level] < 1
|
@@ -322,7 +322,7 @@ module ActiveRecord
|
|
322
322
|
end
|
323
323
|
|
324
324
|
# Restore the new record state and id of a record that was previously saved by a call to save_record_state.
|
325
|
-
def restore_transaction_record_state(force = false) #:nodoc
|
325
|
+
def restore_transaction_record_state(force = false) #:nodoc:
|
326
326
|
if defined?(@_start_transaction_state)
|
327
327
|
@_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1
|
328
328
|
if @_start_transaction_state[:level] < 1
|
@@ -341,12 +341,12 @@ module ActiveRecord
|
|
341
341
|
end
|
342
342
|
|
343
343
|
# Determine if a record was created or destroyed in a transaction. State should be one of :new_record or :destroyed.
|
344
|
-
def transaction_record_state(state) #:nodoc
|
344
|
+
def transaction_record_state(state) #:nodoc:
|
345
345
|
@_start_transaction_state[state] if defined?(@_start_transaction_state)
|
346
346
|
end
|
347
347
|
|
348
348
|
# Determine if a transaction included an action for :create, :update, or :destroy. Used in filtering callbacks.
|
349
|
-
def transaction_include_action?(action) #:nodoc
|
349
|
+
def transaction_include_action?(action) #:nodoc:
|
350
350
|
case action
|
351
351
|
when :create
|
352
352
|
transaction_record_state(:new_record)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module Translation
|
3
|
+
include ActiveModel::Translation
|
4
|
+
|
5
|
+
# Set the lookup ancestors for ActiveModel.
|
6
|
+
def lookup_ancestors #:nodoc:
|
7
|
+
klass = self
|
8
|
+
classes = [klass]
|
9
|
+
return classes if klass == ActiveRecord::Base
|
10
|
+
|
11
|
+
while klass != klass.base_class
|
12
|
+
classes << klass = klass.superclass
|
13
|
+
end
|
14
|
+
classes
|
15
|
+
end
|
16
|
+
|
17
|
+
# Set the i18n scope to overwrite ActiveModel.
|
18
|
+
def i18n_scope #:nodoc:
|
19
|
+
:activerecord
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ActiveRecord
|
2
2
|
# = Active Record RecordInvalid
|
3
3
|
#
|
4
|
-
# Raised by <tt>save!</tt> and <tt>create!</tt> when the record is invalid.
|
4
|
+
# Raised by <tt>save!</tt> and <tt>create!</tt> when the record is invalid. Use the
|
5
5
|
# +record+ method to retrieve the record which did not validate.
|
6
6
|
#
|
7
7
|
# begin
|
@@ -2,8 +2,9 @@ module ActiveRecord
|
|
2
2
|
module Validations
|
3
3
|
class AssociatedValidator < ActiveModel::EachValidator
|
4
4
|
def validate_each(record, attribute, value)
|
5
|
-
|
6
|
-
|
5
|
+
if Array.wrap(value).reject {|r| r.marked_for_destruction? || r.valid?}.any?
|
6
|
+
record.errors.add(attribute, :invalid, options.merge(:value => value))
|
7
|
+
end
|
7
8
|
end
|
8
9
|
end
|
9
10
|
|
@@ -29,10 +30,10 @@ module ActiveRecord
|
|
29
30
|
# validation contexts by default (+nil+), other options are <tt>:create</tt>
|
30
31
|
# and <tt>:update</tt>.
|
31
32
|
# * <tt>:if</tt> - Specifies a method, proc or string to call to determine if the validation should
|
32
|
-
# occur (e.g. <tt>:if => :allow_validation</tt>, or <tt>:if => Proc.new { |user| user.signup_step > 2 }</tt>).
|
33
|
+
# occur (e.g. <tt>:if => :allow_validation</tt>, or <tt>:if => Proc.new { |user| user.signup_step > 2 }</tt>). The
|
33
34
|
# method, proc or string should return or evaluate to a true or false value.
|
34
35
|
# * <tt>:unless</tt> - Specifies a method, proc or string to call to determine if the validation should
|
35
|
-
# not occur (e.g. <tt>:unless => :skip_validation</tt>, or <tt>:unless => Proc.new { |user| user.signup_step <= 2 }</tt>).
|
36
|
+
# not occur (e.g. <tt>:unless => :skip_validation</tt>, or <tt>:unless => Proc.new { |user| user.signup_step <= 2 }</tt>). The
|
36
37
|
# method, proc or string should return or evaluate to a true or false value.
|
37
38
|
def validates_associated(*attr_names)
|
38
39
|
validates_with AssociatedValidator, _merge_attributes(attr_names)
|
@@ -57,8 +57,8 @@ module ActiveRecord
|
|
57
57
|
value = column.limit ? value.to_s.mb_chars[0, column.limit] : value.to_s if column.text?
|
58
58
|
|
59
59
|
if !options[:case_sensitive] && value && column.text?
|
60
|
-
# will use SQL LOWER function before comparison
|
61
|
-
relation =
|
60
|
+
# will use SQL LOWER function before comparison, unless it detects a case insensitive collation
|
61
|
+
relation = klass.connection.case_insensitive_comparison(table, attribute, column, value)
|
62
62
|
else
|
63
63
|
value = klass.connection.case_sensitive_modifier(value)
|
64
64
|
relation = table[attribute].eq(value)
|
@@ -83,7 +83,7 @@ module ActiveRecord
|
|
83
83
|
# validates_uniqueness_of :user_name, :scope => :account_id
|
84
84
|
# end
|
85
85
|
#
|
86
|
-
# Or even multiple scope parameters.
|
86
|
+
# Or even multiple scope parameters. For example, making sure that a teacher can only be on the schedule once
|
87
87
|
# per semester for a particular class.
|
88
88
|
#
|
89
89
|
# class TeacherSchedule < ActiveRecord::Base
|
@@ -105,7 +105,7 @@ module ActiveRecord
|
|
105
105
|
# The method, proc or string should return or evaluate to a true or false value.
|
106
106
|
# * <tt>:unless</tt> - Specifies a method, proc or string to call to determine if the validation should
|
107
107
|
# not occur (e.g. <tt>:unless => :skip_validation</tt>, or
|
108
|
-
# <tt>:unless => Proc.new { |user| user.signup_step <= 2 }</tt>).
|
108
|
+
# <tt>:unless => Proc.new { |user| user.signup_step <= 2 }</tt>). The method, proc or string should
|
109
109
|
# return or evaluate to a true or false value.
|
110
110
|
#
|
111
111
|
# === Concurrency and integrity
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class <%= migration_class_name %> < ActiveRecord::Migration
|
2
|
-
def
|
2
|
+
def change
|
3
3
|
create_table :<%= session_table_name %> do |t|
|
4
4
|
t.string :session_id, :null => false
|
5
5
|
t.text :data
|
@@ -9,8 +9,4 @@ class <%= migration_class_name %> < ActiveRecord::Migration
|
|
9
9
|
add_index :<%= session_table_name %>, :session_id
|
10
10
|
add_index :<%= session_table_name %>, :updated_at
|
11
11
|
end
|
12
|
-
|
13
|
-
def down
|
14
|
-
drop_table :<%= session_table_name %>
|
15
|
-
end
|
16
12
|
end
|
metadata
CHANGED
@@ -1,71 +1,60 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0.rc1
|
5
|
+
prerelease: 6
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- David Heinemeier Hansson
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2011-12-20 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: activesupport
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2156029700 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- -
|
19
|
+
- - =
|
18
20
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
21
|
+
version: 3.2.0.rc1
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
|
-
version_requirements:
|
23
|
-
requirements:
|
24
|
-
- - '='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 3.1.12
|
24
|
+
version_requirements: *2156029700
|
27
25
|
- !ruby/object:Gem::Dependency
|
28
26
|
name: activemodel
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &2156028220 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
30
29
|
requirements:
|
31
|
-
- -
|
30
|
+
- - =
|
32
31
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
32
|
+
version: 3.2.0.rc1
|
34
33
|
type: :runtime
|
35
34
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
-
requirements:
|
38
|
-
- - '='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 3.1.12
|
35
|
+
version_requirements: *2156028220
|
41
36
|
- !ruby/object:Gem::Dependency
|
42
37
|
name: arel
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &2156025120 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
44
40
|
requirements:
|
45
41
|
- - ~>
|
46
42
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
43
|
+
version: 3.0.0.rc1
|
48
44
|
type: :runtime
|
49
45
|
prerelease: false
|
50
|
-
version_requirements:
|
51
|
-
requirements:
|
52
|
-
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 2.2.3
|
46
|
+
version_requirements: *2156025120
|
55
47
|
- !ruby/object:Gem::Dependency
|
56
48
|
name: tzinfo
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &2156024360 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 0.3.29
|
62
55
|
type: :runtime
|
63
56
|
prerelease: false
|
64
|
-
version_requirements:
|
65
|
-
requirements:
|
66
|
-
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.3.29
|
57
|
+
version_requirements: *2156024360
|
69
58
|
description: Databases on Rails. Build a persistent domain model by mapping database
|
70
59
|
tables to Ruby classes. Strong conventions for associations, validations, aggregations,
|
71
60
|
migrations, and testing come baked-in.
|
@@ -120,11 +109,14 @@ files:
|
|
120
109
|
- lib/active_record/associations/singular_association.rb
|
121
110
|
- lib/active_record/associations/through_association.rb
|
122
111
|
- lib/active_record/associations.rb
|
112
|
+
- lib/active_record/attribute_assignment.rb
|
123
113
|
- lib/active_record/attribute_methods/before_type_cast.rb
|
114
|
+
- lib/active_record/attribute_methods/deprecated_underscore_read.rb
|
124
115
|
- lib/active_record/attribute_methods/dirty.rb
|
125
116
|
- lib/active_record/attribute_methods/primary_key.rb
|
126
117
|
- lib/active_record/attribute_methods/query.rb
|
127
118
|
- lib/active_record/attribute_methods/read.rb
|
119
|
+
- lib/active_record/attribute_methods/serialization.rb
|
128
120
|
- lib/active_record/attribute_methods/time_zone_conversion.rb
|
129
121
|
- lib/active_record/attribute_methods/write.rb
|
130
122
|
- lib/active_record/attribute_methods.rb
|
@@ -141,52 +133,69 @@ files:
|
|
141
133
|
- lib/active_record/connection_adapters/abstract/schema_definitions.rb
|
142
134
|
- lib/active_record/connection_adapters/abstract/schema_statements.rb
|
143
135
|
- lib/active_record/connection_adapters/abstract_adapter.rb
|
136
|
+
- lib/active_record/connection_adapters/abstract_mysql_adapter.rb
|
144
137
|
- lib/active_record/connection_adapters/column.rb
|
145
138
|
- lib/active_record/connection_adapters/mysql2_adapter.rb
|
146
139
|
- lib/active_record/connection_adapters/mysql_adapter.rb
|
147
140
|
- lib/active_record/connection_adapters/postgresql_adapter.rb
|
141
|
+
- lib/active_record/connection_adapters/schema_cache.rb
|
148
142
|
- lib/active_record/connection_adapters/sqlite3_adapter.rb
|
149
143
|
- lib/active_record/connection_adapters/sqlite_adapter.rb
|
150
144
|
- lib/active_record/connection_adapters/statement_pool.rb
|
151
145
|
- lib/active_record/counter_cache.rb
|
152
146
|
- lib/active_record/dynamic_finder_match.rb
|
147
|
+
- lib/active_record/dynamic_matchers.rb
|
153
148
|
- lib/active_record/dynamic_scope_match.rb
|
154
149
|
- lib/active_record/errors.rb
|
150
|
+
- lib/active_record/explain.rb
|
151
|
+
- lib/active_record/explain_subscriber.rb
|
152
|
+
- lib/active_record/fixtures/file.rb
|
155
153
|
- lib/active_record/fixtures.rb
|
156
154
|
- lib/active_record/identity_map.rb
|
155
|
+
- lib/active_record/inheritance.rb
|
156
|
+
- lib/active_record/integration.rb
|
157
157
|
- lib/active_record/locale/en.yml
|
158
158
|
- lib/active_record/locking/optimistic.rb
|
159
159
|
- lib/active_record/locking/pessimistic.rb
|
160
160
|
- lib/active_record/log_subscriber.rb
|
161
161
|
- lib/active_record/migration/command_recorder.rb
|
162
162
|
- lib/active_record/migration.rb
|
163
|
-
- lib/active_record/
|
163
|
+
- lib/active_record/model_schema.rb
|
164
164
|
- lib/active_record/nested_attributes.rb
|
165
165
|
- lib/active_record/observer.rb
|
166
166
|
- lib/active_record/persistence.rb
|
167
167
|
- lib/active_record/query_cache.rb
|
168
|
+
- lib/active_record/querying.rb
|
168
169
|
- lib/active_record/railtie.rb
|
169
170
|
- lib/active_record/railties/console_sandbox.rb
|
170
171
|
- lib/active_record/railties/controller_runtime.rb
|
171
172
|
- lib/active_record/railties/databases.rake
|
172
173
|
- lib/active_record/railties/jdbcmysql_error.rb
|
174
|
+
- lib/active_record/readonly_attributes.rb
|
173
175
|
- lib/active_record/reflection.rb
|
174
176
|
- lib/active_record/relation/batches.rb
|
175
177
|
- lib/active_record/relation/calculations.rb
|
178
|
+
- lib/active_record/relation/delegation.rb
|
176
179
|
- lib/active_record/relation/finder_methods.rb
|
177
180
|
- lib/active_record/relation/predicate_builder.rb
|
178
181
|
- lib/active_record/relation/query_methods.rb
|
179
182
|
- lib/active_record/relation/spawn_methods.rb
|
180
183
|
- lib/active_record/relation.rb
|
181
184
|
- lib/active_record/result.rb
|
185
|
+
- lib/active_record/sanitization.rb
|
182
186
|
- lib/active_record/schema.rb
|
183
187
|
- lib/active_record/schema_dumper.rb
|
188
|
+
- lib/active_record/scoping/default.rb
|
189
|
+
- lib/active_record/scoping/named.rb
|
190
|
+
- lib/active_record/scoping.rb
|
184
191
|
- lib/active_record/serialization.rb
|
185
192
|
- lib/active_record/serializers/xml_serializer.rb
|
186
193
|
- lib/active_record/session_store.rb
|
194
|
+
- lib/active_record/store.rb
|
187
195
|
- lib/active_record/test_case.rb
|
188
196
|
- lib/active_record/timestamp.rb
|
189
197
|
- lib/active_record/transactions.rb
|
198
|
+
- lib/active_record/translation.rb
|
190
199
|
- lib/active_record/validations/associated.rb
|
191
200
|
- lib/active_record/validations/uniqueness.rb
|
192
201
|
- lib/active_record/validations.rb
|
@@ -206,7 +215,6 @@ files:
|
|
206
215
|
- lib/rails/generators/active_record.rb
|
207
216
|
homepage: http://www.rubyonrails.org
|
208
217
|
licenses: []
|
209
|
-
metadata: {}
|
210
218
|
post_install_message:
|
211
219
|
rdoc_options:
|
212
220
|
- --main
|
@@ -214,19 +222,21 @@ rdoc_options:
|
|
214
222
|
require_paths:
|
215
223
|
- lib
|
216
224
|
required_ruby_version: !ruby/object:Gem::Requirement
|
225
|
+
none: false
|
217
226
|
requirements:
|
218
|
-
- - '>='
|
227
|
+
- - ! '>='
|
219
228
|
- !ruby/object:Gem::Version
|
220
229
|
version: 1.8.7
|
221
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
231
|
+
none: false
|
222
232
|
requirements:
|
223
|
-
- - '
|
233
|
+
- - ! '>'
|
224
234
|
- !ruby/object:Gem::Version
|
225
|
-
version:
|
235
|
+
version: 1.3.1
|
226
236
|
requirements: []
|
227
237
|
rubyforge_project:
|
228
|
-
rubygems_version:
|
238
|
+
rubygems_version: 1.8.7
|
229
239
|
signing_key:
|
230
|
-
specification_version:
|
240
|
+
specification_version: 3
|
231
241
|
summary: Object-relational mapper framework (part of Rails).
|
232
242
|
test_files: []
|