square-activerecord 3.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6140 -0
- data/README.rdoc +222 -0
- data/examples/associations.png +0 -0
- data/examples/performance.rb +179 -0
- data/examples/simple.rb +14 -0
- data/lib/active_record.rb +124 -0
- data/lib/active_record/aggregations.rb +277 -0
- data/lib/active_record/association_preload.rb +430 -0
- data/lib/active_record/associations.rb +2307 -0
- data/lib/active_record/associations/association_collection.rb +572 -0
- data/lib/active_record/associations/association_proxy.rb +299 -0
- data/lib/active_record/associations/belongs_to_association.rb +91 -0
- data/lib/active_record/associations/belongs_to_polymorphic_association.rb +82 -0
- data/lib/active_record/associations/has_and_belongs_to_many_association.rb +143 -0
- data/lib/active_record/associations/has_many_association.rb +128 -0
- data/lib/active_record/associations/has_many_through_association.rb +115 -0
- data/lib/active_record/associations/has_one_association.rb +143 -0
- data/lib/active_record/associations/has_one_through_association.rb +40 -0
- data/lib/active_record/associations/through_association_scope.rb +154 -0
- data/lib/active_record/attribute_methods.rb +60 -0
- data/lib/active_record/attribute_methods/before_type_cast.rb +30 -0
- data/lib/active_record/attribute_methods/dirty.rb +95 -0
- data/lib/active_record/attribute_methods/primary_key.rb +56 -0
- data/lib/active_record/attribute_methods/query.rb +39 -0
- data/lib/active_record/attribute_methods/read.rb +145 -0
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +64 -0
- data/lib/active_record/attribute_methods/write.rb +43 -0
- data/lib/active_record/autosave_association.rb +369 -0
- data/lib/active_record/base.rb +1904 -0
- data/lib/active_record/callbacks.rb +284 -0
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +364 -0
- data/lib/active_record/connection_adapters/abstract/connection_specification.rb +113 -0
- data/lib/active_record/connection_adapters/abstract/database_limits.rb +57 -0
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +333 -0
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +81 -0
- data/lib/active_record/connection_adapters/abstract/quoting.rb +73 -0
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +739 -0
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +539 -0
- data/lib/active_record/connection_adapters/abstract_adapter.rb +217 -0
- data/lib/active_record/connection_adapters/mysql_adapter.rb +657 -0
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +1031 -0
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +61 -0
- data/lib/active_record/connection_adapters/sqlite_adapter.rb +401 -0
- data/lib/active_record/counter_cache.rb +115 -0
- data/lib/active_record/dynamic_finder_match.rb +56 -0
- data/lib/active_record/dynamic_scope_match.rb +23 -0
- data/lib/active_record/errors.rb +172 -0
- data/lib/active_record/fixtures.rb +1006 -0
- data/lib/active_record/locale/en.yml +40 -0
- data/lib/active_record/locking/optimistic.rb +172 -0
- data/lib/active_record/locking/pessimistic.rb +55 -0
- data/lib/active_record/log_subscriber.rb +48 -0
- data/lib/active_record/migration.rb +617 -0
- data/lib/active_record/named_scope.rb +138 -0
- data/lib/active_record/nested_attributes.rb +419 -0
- data/lib/active_record/observer.rb +125 -0
- data/lib/active_record/persistence.rb +290 -0
- data/lib/active_record/query_cache.rb +36 -0
- data/lib/active_record/railtie.rb +91 -0
- data/lib/active_record/railties/controller_runtime.rb +38 -0
- data/lib/active_record/railties/databases.rake +512 -0
- data/lib/active_record/reflection.rb +411 -0
- data/lib/active_record/relation.rb +394 -0
- data/lib/active_record/relation/batches.rb +89 -0
- data/lib/active_record/relation/calculations.rb +295 -0
- data/lib/active_record/relation/finder_methods.rb +363 -0
- data/lib/active_record/relation/predicate_builder.rb +48 -0
- data/lib/active_record/relation/query_methods.rb +303 -0
- data/lib/active_record/relation/spawn_methods.rb +132 -0
- data/lib/active_record/schema.rb +59 -0
- data/lib/active_record/schema_dumper.rb +195 -0
- data/lib/active_record/serialization.rb +60 -0
- data/lib/active_record/serializers/xml_serializer.rb +244 -0
- data/lib/active_record/session_store.rb +340 -0
- data/lib/active_record/test_case.rb +67 -0
- data/lib/active_record/timestamp.rb +88 -0
- data/lib/active_record/transactions.rb +359 -0
- data/lib/active_record/validations.rb +84 -0
- data/lib/active_record/validations/associated.rb +48 -0
- data/lib/active_record/validations/uniqueness.rb +190 -0
- data/lib/active_record/version.rb +10 -0
- data/lib/rails/generators/active_record.rb +19 -0
- data/lib/rails/generators/active_record/migration.rb +15 -0
- data/lib/rails/generators/active_record/migration/migration_generator.rb +25 -0
- data/lib/rails/generators/active_record/migration/templates/migration.rb +17 -0
- data/lib/rails/generators/active_record/model/model_generator.rb +38 -0
- data/lib/rails/generators/active_record/model/templates/migration.rb +16 -0
- data/lib/rails/generators/active_record/model/templates/model.rb +5 -0
- data/lib/rails/generators/active_record/model/templates/module.rb +5 -0
- data/lib/rails/generators/active_record/observer/observer_generator.rb +15 -0
- data/lib/rails/generators/active_record/observer/templates/observer.rb +2 -0
- data/lib/rails/generators/active_record/session_migration/session_migration_generator.rb +24 -0
- data/lib/rails/generators/active_record/session_migration/templates/migration.rb +16 -0
- metadata +223 -0
@@ -0,0 +1,190 @@
|
|
1
|
+
require 'active_support/core_ext/array/wrap'
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module Validations
|
5
|
+
class UniquenessValidator < ActiveModel::EachValidator
|
6
|
+
def initialize(options)
|
7
|
+
super(options.reverse_merge(:case_sensitive => true))
|
8
|
+
end
|
9
|
+
|
10
|
+
# Unfortunately, we have to tie Uniqueness validators to a class.
|
11
|
+
def setup(klass)
|
12
|
+
@klass = klass
|
13
|
+
end
|
14
|
+
|
15
|
+
def validate_each(record, attribute, value)
|
16
|
+
finder_class = find_finder_class_for(record)
|
17
|
+
table = finder_class.unscoped
|
18
|
+
|
19
|
+
table_name = record.class.quoted_table_name
|
20
|
+
|
21
|
+
if value && record.class.serialized_attributes.key?(attribute.to_s)
|
22
|
+
value = YAML.dump value
|
23
|
+
end
|
24
|
+
|
25
|
+
sql, params = mount_sql_and_params(finder_class, table_name, attribute, value)
|
26
|
+
|
27
|
+
relation = table.where(sql, *params)
|
28
|
+
|
29
|
+
Array.wrap(options[:scope]).each do |scope_item|
|
30
|
+
scope_value = record.send(scope_item)
|
31
|
+
relation = relation.where(scope_item => scope_value)
|
32
|
+
end
|
33
|
+
|
34
|
+
unless record.new_record?
|
35
|
+
# TODO : This should be in Arel
|
36
|
+
relation = relation.where("#{record.class.quoted_table_name}.#{record.class.primary_key} <> ?", record.send(:id))
|
37
|
+
end
|
38
|
+
|
39
|
+
if relation.exists?
|
40
|
+
record.errors.add(attribute, :taken, options.except(:case_sensitive, :scope).merge(:value => value))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
protected
|
45
|
+
|
46
|
+
# The check for an existing value should be run from a class that
|
47
|
+
# isn't abstract. This means working down from the current class
|
48
|
+
# (self), to the first non-abstract class. Since classes don't know
|
49
|
+
# their subclasses, we have to build the hierarchy between self and
|
50
|
+
# the record's class.
|
51
|
+
def find_finder_class_for(record) #:nodoc:
|
52
|
+
class_hierarchy = [record.class]
|
53
|
+
|
54
|
+
while class_hierarchy.first != @klass
|
55
|
+
class_hierarchy.insert(0, class_hierarchy.first.superclass)
|
56
|
+
end
|
57
|
+
|
58
|
+
class_hierarchy.detect { |klass| !klass.abstract_class? }
|
59
|
+
end
|
60
|
+
|
61
|
+
def mount_sql_and_params(klass, table_name, attribute, value) #:nodoc:
|
62
|
+
column = klass.columns_hash[attribute.to_s]
|
63
|
+
|
64
|
+
operator = if value.nil?
|
65
|
+
"IS ?"
|
66
|
+
elsif column.text?
|
67
|
+
value = column.limit ? value.to_s.mb_chars[0, column.limit] : value.to_s
|
68
|
+
"#{klass.connection.case_sensitive_equality_operator} ?"
|
69
|
+
else
|
70
|
+
"= ?"
|
71
|
+
end
|
72
|
+
|
73
|
+
sql_attribute = "#{table_name}.#{klass.connection.quote_column_name(attribute)}"
|
74
|
+
|
75
|
+
if value.nil? || (options[:case_sensitive] || !column.text?)
|
76
|
+
sql = "#{sql_attribute} #{operator}"
|
77
|
+
else
|
78
|
+
sql = "LOWER(#{sql_attribute}) = LOWER(?)"
|
79
|
+
end
|
80
|
+
|
81
|
+
[sql, [value]]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
module ClassMethods
|
86
|
+
# Validates whether the value of the specified attributes are unique across the system.
|
87
|
+
# Useful for making sure that only one user
|
88
|
+
# can be named "davidhh".
|
89
|
+
#
|
90
|
+
# class Person < ActiveRecord::Base
|
91
|
+
# validates_uniqueness_of :user_name, :scope => :account_id
|
92
|
+
# end
|
93
|
+
#
|
94
|
+
# It can also validate whether the value of the specified attributes are unique based on multiple
|
95
|
+
# scope parameters. For example, making sure that a teacher can only be on the schedule once
|
96
|
+
# per semester for a particular class.
|
97
|
+
#
|
98
|
+
# class TeacherSchedule < ActiveRecord::Base
|
99
|
+
# validates_uniqueness_of :teacher_id, :scope => [:semester_id, :class_id]
|
100
|
+
# end
|
101
|
+
#
|
102
|
+
# When the record is created, a check is performed to make sure that no record exists in the database
|
103
|
+
# with the given value for the specified attribute (that maps to a column). When the record is updated,
|
104
|
+
# the same check is made but disregarding the record itself.
|
105
|
+
#
|
106
|
+
# Configuration options:
|
107
|
+
# * <tt>:message</tt> - Specifies a custom error message (default is: "has already been taken").
|
108
|
+
# * <tt>:scope</tt> - One or more columns by which to limit the scope of the uniqueness constraint.
|
109
|
+
# * <tt>:case_sensitive</tt> - Looks for an exact match. Ignored by non-text columns (+true+ by default).
|
110
|
+
# * <tt>:allow_nil</tt> - If set to true, skips this validation if the attribute is +nil+ (default is +false+).
|
111
|
+
# * <tt>:allow_blank</tt> - If set to true, skips this validation if the attribute is blank (default is +false+).
|
112
|
+
# * <tt>:if</tt> - Specifies a method, proc or string to call to determine if the validation should
|
113
|
+
# occur (e.g. <tt>:if => :allow_validation</tt>, or <tt>:if => Proc.new { |user| user.signup_step > 2 }</tt>).
|
114
|
+
# The method, proc or string should return or evaluate to a true or false value.
|
115
|
+
# * <tt>:unless</tt> - Specifies a method, proc or string to call to determine if the validation should
|
116
|
+
# not occur (e.g. <tt>:unless => :skip_validation</tt>, or
|
117
|
+
# <tt>:unless => Proc.new { |user| user.signup_step <= 2 }</tt>). The method, proc or string should
|
118
|
+
# return or evaluate to a true or false value.
|
119
|
+
#
|
120
|
+
# === Concurrency and integrity
|
121
|
+
#
|
122
|
+
# Using this validation method in conjunction with ActiveRecord::Base#save
|
123
|
+
# does not guarantee the absence of duplicate record insertions, because
|
124
|
+
# uniqueness checks on the application level are inherently prone to race
|
125
|
+
# conditions. For example, suppose that two users try to post a Comment at
|
126
|
+
# the same time, and a Comment's title must be unique. At the database-level,
|
127
|
+
# the actions performed by these users could be interleaved in the following manner:
|
128
|
+
#
|
129
|
+
# User 1 | User 2
|
130
|
+
# ------------------------------------+--------------------------------------
|
131
|
+
# # User 1 checks whether there's |
|
132
|
+
# # already a comment with the title |
|
133
|
+
# # 'My Post'. This is not the case. |
|
134
|
+
# SELECT * FROM comments |
|
135
|
+
# WHERE title = 'My Post' |
|
136
|
+
# |
|
137
|
+
# | # User 2 does the same thing and also
|
138
|
+
# | # infers that his title is unique.
|
139
|
+
# | SELECT * FROM comments
|
140
|
+
# | WHERE title = 'My Post'
|
141
|
+
# |
|
142
|
+
# # User 1 inserts his comment. |
|
143
|
+
# INSERT INTO comments |
|
144
|
+
# (title, content) VALUES |
|
145
|
+
# ('My Post', 'hi!') |
|
146
|
+
# |
|
147
|
+
# | # User 2 does the same thing.
|
148
|
+
# | INSERT INTO comments
|
149
|
+
# | (title, content) VALUES
|
150
|
+
# | ('My Post', 'hello!')
|
151
|
+
# |
|
152
|
+
# | # ^^^^^^
|
153
|
+
# | # Boom! We now have a duplicate
|
154
|
+
# | # title!
|
155
|
+
#
|
156
|
+
# This could even happen if you use transactions with the 'serializable'
|
157
|
+
# isolation level. There are several ways to get around this problem:
|
158
|
+
#
|
159
|
+
# - By locking the database table before validating, and unlocking it after
|
160
|
+
# saving. However, table locking is very expensive, and thus not
|
161
|
+
# recommended.
|
162
|
+
# - By locking a lock file before validating, and unlocking it after saving.
|
163
|
+
# This does not work if you've scaled your Rails application across
|
164
|
+
# multiple web servers (because they cannot share lock files, or cannot
|
165
|
+
# do that efficiently), and thus not recommended.
|
166
|
+
# - Creating a unique index on the field, by using
|
167
|
+
# ActiveRecord::ConnectionAdapters::SchemaStatements#add_index. In the
|
168
|
+
# rare case that a race condition occurs, the database will guarantee
|
169
|
+
# the field's uniqueness.
|
170
|
+
#
|
171
|
+
# When the database catches such a duplicate insertion,
|
172
|
+
# ActiveRecord::Base#save will raise an ActiveRecord::StatementInvalid
|
173
|
+
# exception. You can either choose to let this error propagate (which
|
174
|
+
# will result in the default Rails exception page being shown), or you
|
175
|
+
# can catch it and restart the transaction (e.g. by telling the user
|
176
|
+
# that the title already exists, and asking him to re-enter the title).
|
177
|
+
# This technique is also known as optimistic concurrency control:
|
178
|
+
# http://en.wikipedia.org/wiki/Optimistic_concurrency_control
|
179
|
+
#
|
180
|
+
# Active Record currently provides no way to distinguish unique
|
181
|
+
# index constraint errors from other types of database errors, so you
|
182
|
+
# will have to parse the (database-specific) exception message to detect
|
183
|
+
# such a case.
|
184
|
+
#
|
185
|
+
def validates_uniqueness_of(*attr_names)
|
186
|
+
validates_with UniquenessValidator, _merge_attributes(attr_names)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails/generators/named_base'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
require 'rails/generators/active_model'
|
4
|
+
require 'rails/generators/active_record/migration'
|
5
|
+
require 'active_record'
|
6
|
+
|
7
|
+
module ActiveRecord
|
8
|
+
module Generators
|
9
|
+
class Base < Rails::Generators::NamedBase #:nodoc:
|
10
|
+
include Rails::Generators::Migration
|
11
|
+
extend ActiveRecord::Generators::Migration
|
12
|
+
|
13
|
+
# Set the current directory as base for the inherited generators.
|
14
|
+
def self.base_root
|
15
|
+
File.dirname(__FILE__)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module Generators
|
3
|
+
module Migration
|
4
|
+
# Implement the required interface for Rails::Generators::Migration.
|
5
|
+
def next_migration_number(dirname) #:nodoc:
|
6
|
+
next_migration_number = current_migration_number(dirname) + 1
|
7
|
+
if ActiveRecord::Base.timestamped_migrations
|
8
|
+
[Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
|
9
|
+
else
|
10
|
+
"%.3d" % next_migration_number
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module Generators
|
5
|
+
class MigrationGenerator < Base
|
6
|
+
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
7
|
+
|
8
|
+
def create_migration_file
|
9
|
+
set_local_assigns!
|
10
|
+
migration_template "migration.rb", "db/migrate/#{file_name}.rb"
|
11
|
+
end
|
12
|
+
|
13
|
+
protected
|
14
|
+
attr_reader :migration_action
|
15
|
+
|
16
|
+
def set_local_assigns!
|
17
|
+
if file_name =~ /^(add|remove)_.*_(?:to|from)_(.*)/
|
18
|
+
@migration_action = $1
|
19
|
+
@table_name = $2.pluralize
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class <%= migration_class_name %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
<% attributes.each do |attribute| -%>
|
4
|
+
<%- if migration_action -%>
|
5
|
+
<%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end %>
|
6
|
+
<%- end -%>
|
7
|
+
<%- end -%>
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
<% attributes.reverse.each do |attribute| -%>
|
12
|
+
<%- if migration_action -%>
|
13
|
+
<%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><% end %>
|
14
|
+
<%- end -%>
|
15
|
+
<%- end -%>
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module Generators
|
5
|
+
class ModelGenerator < Base
|
6
|
+
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
7
|
+
|
8
|
+
check_class_collision
|
9
|
+
|
10
|
+
class_option :migration, :type => :boolean
|
11
|
+
class_option :timestamps, :type => :boolean
|
12
|
+
class_option :parent, :type => :string, :desc => "The parent class for the generated model"
|
13
|
+
|
14
|
+
def create_migration_file
|
15
|
+
return unless options[:migration] && options[:parent].nil?
|
16
|
+
migration_template "migration.rb", "db/migrate/create_#{table_name}.rb"
|
17
|
+
end
|
18
|
+
|
19
|
+
def create_model_file
|
20
|
+
template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_module_file
|
24
|
+
return if class_path.empty?
|
25
|
+
template 'module.rb', File.join('app/models', "#{class_path.join('/')}.rb") if behavior == :invoke
|
26
|
+
end
|
27
|
+
|
28
|
+
hook_for :test_framework
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def parent_class_name
|
33
|
+
options[:parent] || "ActiveRecord::Base"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class <%= migration_class_name %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :<%= table_name %> do |t|
|
4
|
+
<% for attribute in attributes -%>
|
5
|
+
t.<%= attribute.type %> :<%= attribute.name %>
|
6
|
+
<% end -%>
|
7
|
+
<% if options[:timestamps] %>
|
8
|
+
t.timestamps
|
9
|
+
<% end -%>
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :<%= table_name %>
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module Generators
|
5
|
+
class ObserverGenerator < Base
|
6
|
+
check_class_collision :suffix => "Observer"
|
7
|
+
|
8
|
+
def create_observer_file
|
9
|
+
template 'observer.rb', File.join('app/models', class_path, "#{file_name}_observer.rb")
|
10
|
+
end
|
11
|
+
|
12
|
+
hook_for :test_framework
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module Generators
|
5
|
+
class SessionMigrationGenerator < Base
|
6
|
+
argument :name, :type => :string, :default => "add_sessions_table"
|
7
|
+
|
8
|
+
def create_migration_file
|
9
|
+
migration_template "migration.rb", "db/migrate/#{file_name}.rb"
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def session_table_name
|
15
|
+
current_table_name = ActiveRecord::SessionStore::Session.table_name
|
16
|
+
if ["sessions", "session"].include?(current_table_name)
|
17
|
+
current_table_name = (ActiveRecord::Base.pluralize_table_names ? 'session'.pluralize : 'session')
|
18
|
+
end
|
19
|
+
current_table_name
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class <%= migration_class_name %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :<%= session_table_name %> do |t|
|
4
|
+
t.string :session_id, :null => false
|
5
|
+
t.text :data
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
|
9
|
+
add_index :<%= session_table_name %>, :session_id
|
10
|
+
add_index :<%= session_table_name %>, :updated_at
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :<%= session_table_name %>
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,223 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: square-activerecord
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
- 7
|
10
|
+
version: 3.0.7
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- David Heinemeier Hansson
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-05-16 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: activesupport
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - "="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 9
|
29
|
+
segments:
|
30
|
+
- 3
|
31
|
+
- 0
|
32
|
+
- 7
|
33
|
+
version: 3.0.7
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: activemodel
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - "="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 9
|
45
|
+
segments:
|
46
|
+
- 3
|
47
|
+
- 0
|
48
|
+
- 7
|
49
|
+
version: 3.0.7
|
50
|
+
type: :runtime
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: square-arel
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 11
|
61
|
+
segments:
|
62
|
+
- 2
|
63
|
+
- 0
|
64
|
+
- 2
|
65
|
+
version: 2.0.2
|
66
|
+
type: :runtime
|
67
|
+
version_requirements: *id003
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: tzinfo
|
70
|
+
prerelease: false
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 61
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
- 3
|
80
|
+
- 23
|
81
|
+
version: 0.3.23
|
82
|
+
type: :runtime
|
83
|
+
version_requirements: *id004
|
84
|
+
description: Databases on Rails. Build a persistent domain model by mapping database tables to Ruby classes. Strong conventions for associations, validations, aggregations, migrations, and testing come baked-in.
|
85
|
+
email: david@loudthinking.com
|
86
|
+
executables: []
|
87
|
+
|
88
|
+
extensions: []
|
89
|
+
|
90
|
+
extra_rdoc_files:
|
91
|
+
- README.rdoc
|
92
|
+
files:
|
93
|
+
- CHANGELOG
|
94
|
+
- README.rdoc
|
95
|
+
- examples/associations.png
|
96
|
+
- examples/performance.rb
|
97
|
+
- examples/simple.rb
|
98
|
+
- lib/active_record/aggregations.rb
|
99
|
+
- lib/active_record/association_preload.rb
|
100
|
+
- lib/active_record/associations/association_collection.rb
|
101
|
+
- lib/active_record/associations/association_proxy.rb
|
102
|
+
- lib/active_record/associations/belongs_to_association.rb
|
103
|
+
- lib/active_record/associations/belongs_to_polymorphic_association.rb
|
104
|
+
- lib/active_record/associations/has_and_belongs_to_many_association.rb
|
105
|
+
- lib/active_record/associations/has_many_association.rb
|
106
|
+
- lib/active_record/associations/has_many_through_association.rb
|
107
|
+
- lib/active_record/associations/has_one_association.rb
|
108
|
+
- lib/active_record/associations/has_one_through_association.rb
|
109
|
+
- lib/active_record/associations/through_association_scope.rb
|
110
|
+
- lib/active_record/associations.rb
|
111
|
+
- lib/active_record/attribute_methods/before_type_cast.rb
|
112
|
+
- lib/active_record/attribute_methods/dirty.rb
|
113
|
+
- lib/active_record/attribute_methods/primary_key.rb
|
114
|
+
- lib/active_record/attribute_methods/query.rb
|
115
|
+
- lib/active_record/attribute_methods/read.rb
|
116
|
+
- lib/active_record/attribute_methods/time_zone_conversion.rb
|
117
|
+
- lib/active_record/attribute_methods/write.rb
|
118
|
+
- lib/active_record/attribute_methods.rb
|
119
|
+
- lib/active_record/autosave_association.rb
|
120
|
+
- lib/active_record/base.rb
|
121
|
+
- lib/active_record/callbacks.rb
|
122
|
+
- lib/active_record/connection_adapters/abstract/connection_pool.rb
|
123
|
+
- lib/active_record/connection_adapters/abstract/connection_specification.rb
|
124
|
+
- lib/active_record/connection_adapters/abstract/database_limits.rb
|
125
|
+
- lib/active_record/connection_adapters/abstract/database_statements.rb
|
126
|
+
- lib/active_record/connection_adapters/abstract/query_cache.rb
|
127
|
+
- lib/active_record/connection_adapters/abstract/quoting.rb
|
128
|
+
- lib/active_record/connection_adapters/abstract/schema_definitions.rb
|
129
|
+
- lib/active_record/connection_adapters/abstract/schema_statements.rb
|
130
|
+
- lib/active_record/connection_adapters/abstract_adapter.rb
|
131
|
+
- lib/active_record/connection_adapters/mysql_adapter.rb
|
132
|
+
- lib/active_record/connection_adapters/postgresql_adapter.rb
|
133
|
+
- lib/active_record/connection_adapters/sqlite3_adapter.rb
|
134
|
+
- lib/active_record/connection_adapters/sqlite_adapter.rb
|
135
|
+
- lib/active_record/counter_cache.rb
|
136
|
+
- lib/active_record/dynamic_finder_match.rb
|
137
|
+
- lib/active_record/dynamic_scope_match.rb
|
138
|
+
- lib/active_record/errors.rb
|
139
|
+
- lib/active_record/fixtures.rb
|
140
|
+
- lib/active_record/locale/en.yml
|
141
|
+
- lib/active_record/locking/optimistic.rb
|
142
|
+
- lib/active_record/locking/pessimistic.rb
|
143
|
+
- lib/active_record/log_subscriber.rb
|
144
|
+
- lib/active_record/migration.rb
|
145
|
+
- lib/active_record/named_scope.rb
|
146
|
+
- lib/active_record/nested_attributes.rb
|
147
|
+
- lib/active_record/observer.rb
|
148
|
+
- lib/active_record/persistence.rb
|
149
|
+
- lib/active_record/query_cache.rb
|
150
|
+
- lib/active_record/railtie.rb
|
151
|
+
- lib/active_record/railties/controller_runtime.rb
|
152
|
+
- lib/active_record/railties/databases.rake
|
153
|
+
- lib/active_record/reflection.rb
|
154
|
+
- lib/active_record/relation/batches.rb
|
155
|
+
- lib/active_record/relation/calculations.rb
|
156
|
+
- lib/active_record/relation/finder_methods.rb
|
157
|
+
- lib/active_record/relation/predicate_builder.rb
|
158
|
+
- lib/active_record/relation/query_methods.rb
|
159
|
+
- lib/active_record/relation/spawn_methods.rb
|
160
|
+
- lib/active_record/relation.rb
|
161
|
+
- lib/active_record/schema.rb
|
162
|
+
- lib/active_record/schema_dumper.rb
|
163
|
+
- lib/active_record/serialization.rb
|
164
|
+
- lib/active_record/serializers/xml_serializer.rb
|
165
|
+
- lib/active_record/session_store.rb
|
166
|
+
- lib/active_record/test_case.rb
|
167
|
+
- lib/active_record/timestamp.rb
|
168
|
+
- lib/active_record/transactions.rb
|
169
|
+
- lib/active_record/validations/associated.rb
|
170
|
+
- lib/active_record/validations/uniqueness.rb
|
171
|
+
- lib/active_record/validations.rb
|
172
|
+
- lib/active_record/version.rb
|
173
|
+
- lib/active_record.rb
|
174
|
+
- lib/rails/generators/active_record/migration/migration_generator.rb
|
175
|
+
- lib/rails/generators/active_record/migration/templates/migration.rb
|
176
|
+
- lib/rails/generators/active_record/migration.rb
|
177
|
+
- lib/rails/generators/active_record/model/model_generator.rb
|
178
|
+
- lib/rails/generators/active_record/model/templates/migration.rb
|
179
|
+
- lib/rails/generators/active_record/model/templates/model.rb
|
180
|
+
- lib/rails/generators/active_record/model/templates/module.rb
|
181
|
+
- lib/rails/generators/active_record/observer/observer_generator.rb
|
182
|
+
- lib/rails/generators/active_record/observer/templates/observer.rb
|
183
|
+
- lib/rails/generators/active_record/session_migration/session_migration_generator.rb
|
184
|
+
- lib/rails/generators/active_record/session_migration/templates/migration.rb
|
185
|
+
- lib/rails/generators/active_record.rb
|
186
|
+
homepage: http://www.rubyonrails.org
|
187
|
+
licenses: []
|
188
|
+
|
189
|
+
post_install_message:
|
190
|
+
rdoc_options:
|
191
|
+
- --main
|
192
|
+
- README.rdoc
|
193
|
+
require_paths:
|
194
|
+
- lib
|
195
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
196
|
+
none: false
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
hash: 57
|
201
|
+
segments:
|
202
|
+
- 1
|
203
|
+
- 8
|
204
|
+
- 7
|
205
|
+
version: 1.8.7
|
206
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
|
+
none: false
|
208
|
+
requirements:
|
209
|
+
- - ">="
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
hash: 3
|
212
|
+
segments:
|
213
|
+
- 0
|
214
|
+
version: "0"
|
215
|
+
requirements: []
|
216
|
+
|
217
|
+
rubyforge_project: activerecord
|
218
|
+
rubygems_version: 1.8.2
|
219
|
+
signing_key:
|
220
|
+
specification_version: 3
|
221
|
+
summary: Object-relational mapper framework (part of Rails).
|
222
|
+
test_files: []
|
223
|
+
|