Les Fletcher
f956759f8a
fix after_initialize edge case ( close #2074 and close #2175 )
...
fix behavior when after_initialize is defined and a block is passed to Base.create
2011-07-24 00:31:28 -04:00
Aaron Patterson
a14f4566dd
Merge pull request #2185 from castlerock/lazy_load_abstract_adapter
...
lazy load ConnectionAdapters remove require.
2011-07-23 20:51:43 -07:00
Xavier Noria
a62f450661
Merge pull request #2086 from amatsuda/date_multiparameter_nil
...
convert multiple Date parameters into a nil if any of its bits were blank
2011-07-23 11:20:12 -07:00
Santiago Pastorino
7dadb6aa0a
Merge pull request #2171 from arunagw/database-rake-1.9.2
...
This conditions is required to work with database create task. 1.9.2 is h
2011-07-23 07:58:59 -07:00
Xavier Noria
ace3723d2f
Merge branch 'master' of git://github.com/lifo/docrails
2011-07-23 12:15:41 +02:00
Vijay Dev
a2778861fe
Fixes typo
2011-07-22 08:41:00 -07:00
Vishnu Atrai
1efd88283e
lazy load ConnectionAdapters remove require.
2011-07-22 17:49:24 +05:30
Aaron Patterson
1a0b7ea3c9
adding more tests around database uri parsing
2011-07-21 12:57:05 -07:00
Arun Agrawal
fbf4bee6ed
This conditions is required to work with database create task. 1.9.2 is having a bug with "Calling return within begin still executes else".
2011-07-21 09:47:42 +05:30
Glenn Gillen
1f427b5341
Add documentation for URL connection strings.
2011-07-20 16:23:31 -07:00
Glenn Gillen
16249feaab
Added test for postgres connections as URL. Fixed query param parsing.
2011-07-20 16:23:31 -07:00
Glenn Gillen
89357c8f83
Provide database connection settings as a URL.
2011-07-20 16:23:31 -07:00
Aaron Patterson
22e47279bc
no need to sort the values
2011-07-20 15:52:53 -07:00
Franck Verrot
8bc314b3b7
assign_nested_attributes_for_collection_association should work with Ruby 1.9 [ Closes #2106 ]
...
Children attributes can be either String's or Symbol's, so let's check if the object responds to to_i.
2011-07-20 15:40:01 -07:00
Aaron Patterson
09a488456a
bigdecimal should be typecast to a float on sqlite3. fixes #2162
2011-07-20 14:39:01 -07:00
Vijay Dev
02cbaf0593
avoid Symbol#to_proc
2011-07-20 00:28:51 +05:30
Norman Clarke
9db2d10b11
Explicitly require Active Support dependencies
...
This fixes errors when using Active Record outside of Rails. In Rails,
these files are required by other classes that are always loaded, so
this error does not happen.
Without core_ext/module/delegation, a NoMethodError is raised because
`delegate` remains undefined.
Without core_ext/class/attribute_acessors, an ArgumentError is raised because
`delegate` does not receive a value for its :to option.
2011-07-19 09:56:02 -03:00
Elliot Winkler
0e1d617b8b
ActiveRecord: Fix eager loading so that giving a blank order clause generates valid SQL
2011-07-18 14:56:37 -06:00
José Valim
da144894e9
Merge pull request #195 from bigfix/active_model_include_serialization
...
ActiveModel support for the :include serialization option
2011-07-18 06:50:43 -07:00
Prem Sichanugrist
1ccca1b9cb
Refactor the code a bit to reduce the duplication
2011-07-17 18:53:15 -04:00
Prem Sichanugrist
6e6994994d
Raise an ArgumentError if user passing less number of argument in the dynamic finder
...
The previous behavior was unintentional, and some people was relying on it. Now the dynamic finder will always expecting the number of arguments to be equal or greater (so you can still pass the options to it.)
So if you were doing this and expecting the second argument to be nil:
User.find_by_username_and_group("sikachu")
You'll now get `ArgumentError: wrong number of arguments (1 for 2).` You'll then have to do this:
User.find_by_username_and_group("sikachu", nil)
2011-07-17 18:44:03 -04:00
John Firebaugh
4860143ee4
ActiveModel support for the :include serialization option
...
This commit moves support for the :include serialization option for
serializing associated objects out of ActiveRecord in into ActiveModel.
The following methods support the :include option:
* serializable_hash
* to_json
* to_xml
Instances must respond to methods named by the values of the :includes
array (or keys of the :includes hash). If an association method returns
an object that is_a?(Enumerable) (which AR has_many associations do), it
is assumed to be a collection association, and its elements must respond
to :serializable_hash. Otherwise it must respond to :serializable_hash
itself.
While here, fix #858 , XmlSerializer should not singularize already
singular association names.
2011-07-17 11:34:07 -07:00
John Firebaugh
0933b6d1ba
We already have the record; no need to retrieve it again
2011-07-17 11:34:06 -07:00
Akira Matsuda
9cd1f754d0
convert multiple Date parameters into a nil if any of its bits were blank
2011-07-15 21:19:23 +09:00
Santiago Pastorino
31ea0276a4
Merge pull request #2063 from elight/master
...
Patch for https://github.com/rails/rails/issues/2059
2011-07-14 11:14:27 -07:00
Evan Light
f13dea8a34
Fix and unit test for https://github.com/rails/rails/issues/2059
...
Cache key was incorrectly using timezone-dependent record#updated_at when it should be using a timezone-independent value to generate the cache key
Minor refactoring to cache_key timezone test
Closes #2059
Adds a test to validate the format of the cache_key for nil and present updated_at values
Correctly handles updated_at == nil
2011-07-14 14:04:02 -04:00
Santiago Pastorino
d632e927ec
Merge pull request #1807 from caius/find_in_batches_id_bug
...
Bugfix by stopping find_in_batches using the records after yielding.
2011-07-14 07:57:04 -07:00
Santiago Pastorino
8cf45150de
Merge pull request #2042 from SAP-Oxygen/master-sqlbypass-patch
...
Fix for SqlBypass session store (for master)
2011-07-12 15:06:00 -07:00
Joseph Wong
88e6c06242
Fix for SqlBypass session store
...
Two issues fixed:
1) connection_pool is not defined - needed by SessionStore#drop_table!
and create_table! since c94651f
2) initialization of connection to the default of AR::Base.connection
only occurred at the singleton level - the instance level method defined
by cattr_accessor did not have this logic
2011-07-12 11:10:25 -07:00
Joseph Wong
66dee26930
Fixed session ID fixation for ActiveRecord::SessionStore
...
I have found that Rails will take an invalid session ID specified by the
client and materialize a session based on that session ID. This means
that it is possible, among other things, for a client to use an
arbitrarily weak session ID or for a client to resurrect a previous used
session ID. In other words, we cannot guarantee that all session IDs are
generated by the server and that they are (statistically) unique through
time.
The fix is to always generate a new session ID in #get_session if an
existing session cannot be found under the incoming session ID.
Also added new tests that make sure that an invalid session ID is never
materialized into a new session, regardless of whether it comes in via a
cookie or a URL parameter (when :cookie_only => false).
2011-07-12 11:09:11 -07:00
Jon Leighton
1712d90050
Fix exception if old and new targets are both nil. Fixes #1471 .
2011-07-12 00:14:45 +01:00
Santiago Pastorino
c3732bfed0
Merge pull request #1823 from gnarg/master
...
Log instrumentation name for exists? queries
2011-07-10 18:02:31 -07:00
Vijay Dev
d2ff099b16
use simpler words in docs
2011-07-10 21:44:06 +05:30
Santiago Pastorino
c5448721b5
to_key on a destroyed model should return nil
2011-07-09 15:36:57 -03:00
Daniel Schierbeck
a982443ae5
Make #extract_schema_and_table an instance method in Utils
...
Also, move the utils test into its own test case.
2011-07-09 14:24:28 +02:00
Akira Matsuda
d1545bcf94
fix AR having() not to raise NoMethodError when the given argument does not respond to empty?
...
having raises NoMethodError: undefined method `empty?' when a Fixnum or Date/Time were passed via varargs
2011-07-09 20:14:41 +09:00
Jon Leighton
111968d402
Foo.joins(:bar).includes(:bar) should result in a single query with :bar as a join. Related: #1873 .
2011-07-09 11:39:04 +01:00
Xavier Noria
b65bd01d55
Merge branch 'master' of git://github.com/lifo/docrails
2011-07-09 12:20:24 +02:00
Tomas D'Stefano
ea4b94a7bf
Destroy association habtm record before destroying the record itself. Fixes issue #402 .
2011-07-08 22:26:54 +01:00
Jon Leighton
dfec3737b0
Ensure that the foreign key gets set when doing record.create_association or record.create_association. Fixes #1960 .
2011-07-08 21:03:54 +01:00
Daniel Schierbeck
9991f0f15a
Refactor PostgreSQLAdapter a bit
...
Move the private method #extract_schema_and_table into a separate
Utils module so that it can be tested without resorting to #send.
2011-07-08 16:05:55 +02:00
Akira Matsuda
49bf8597e6
Use Enumerable#with_index. We're on Ruby > 1.8.7
2011-07-08 21:38:02 +09:00
Akira Matsuda
4d4819fb27
:conditions => where
2011-07-08 06:13:21 +09:00
Akira Matsuda
b2816ae971
:joins => joins
2011-07-08 06:13:21 +09:00
Akira Matsuda
c4bd47778f
:include => includes
2011-07-08 06:13:21 +09:00
Akira Matsuda
6c94f69673
find(:first) => first
2011-07-08 06:13:21 +09:00
Akira Matsuda
a3683fd0e4
find(:all) => all
2011-07-08 06:13:21 +09:00
Santiago Pastorino
63861e0c9c
Merge pull request #1997 from knapo/master
...
Make `ActiveRecord::Batches#find_each` to not return `self`.
2011-07-07 09:00:35 -07:00
Dmitriy Kiriyenko
f1553731ed
Add require ActiveSupport delegation to ActiveRecord::Relation class.
2011-07-07 17:32:18 +03:00
knapo
2ca9b6dfab
Make ActiveRecord::Batches#find_each
to not return self
.
...
This caused that `find_each` was producing extra db call taking all the records from db, and was less efficient than `ActiveRecord::Base#all`.
2011-07-07 11:40:11 +02:00
Santiago Pastorino
1bad08f116
Merge pull request #1120 from lysenko/collection_singular_ids
...
collection_singular_ids ignores association :include option
2011-07-06 20:13:24 -07:00
Santiago Pastorino
c6578d64ca
Merge pull request #1989 from simonbaird/master
...
rake db:test:purge creates mysql database with wrong charset & collation (master branch)
2011-07-06 20:10:14 -07:00
Jon Leighton
86390c3bf3
Don't construct association scope in initializer. This yields a big performance gain for cases where the association is never used to load the target, for example with preloading. Related: #1873 .
2011-07-07 01:07:31 +01:00
Simon Baird
ecd37084b2
Fix charset/collate in mysql recreate_database
...
See new method mysql_creation_options. It is used by both
create_database and recreate_database so they are consistent.
(Cherry pick of 3ba3125b24b532876c95c8d9d00c9b69faab5a60)
2011-07-07 09:27:51 +10:00
Anatoliy Lysenko
66dd2d3d10
Fix bug in collection_singular_ids on has many through association with conditions and includes,
...
when condtions references tables from includes.
Test fail because of invalid sql:
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: comments.id:
SELECT "posts".id FROM "posts" INNER JOIN "readers" ON "posts"."id" = "readers"."post_id"
WHERE "readers"."person_id" = 1 AND (comments.id is null)
Bug described in github#925
This commit will revert fix from 3436fdfc12
, but tests is ok.
Bug described in #6569 ticket.
2011-07-06 23:23:34 +03:00
Ernie Miller
2bdad7669c
Remove case statement changes from 2e0840d and 56ac32a. Inheritance FTW.
2011-07-06 16:13:57 -04:00
Santiago Pastorino
c713cf9a5d
Merge pull request #1273 from jeremyf/feature-association-proxy-send
...
Addresses an inconsistency in the ActiveRecord::Base.method_missing handl
2011-07-06 13:05:58 -07:00
Jon Leighton
2c72830cd9
Merge pull request #1979 from bogdan/association_sum_array_compatibility
...
Fixed AR::Relation#sum compatibility with Array#sum
2011-07-06 00:49:05 -07:00
Santiago Pastorino
b27871a66f
Merge pull request #1968 from bogdan/associations_find_array_compatibility2
...
Fixed CollectionAssociation#find to be compatible with Array#find
2011-07-05 09:41:09 -07:00
Bogdan Gusiev
e7bec4e435
Fixed AR::Relation#sum compatibility with Array#sum
...
In order make Relation behavior closer to Array
Made Relation#sum to accept block and delegate it to Array#sum
2011-07-05 14:36:20 +03:00
Bogdan Gusiev
8ba0c1ac53
Fixed CollectionAssociation#find to be compatible with Array#find
...
In order to make CollectionAssociation behave closer to Array
Add the ability to pass block to #find method just like Array#find does.
2011-07-05 10:51:40 +03:00
Xavier Noria
289b5253ce
Merge branch 'master' of git://github.com/lifo/docrails
2011-07-05 01:42:13 +02:00
Dieter Komendera
7d3aa2462c
Only call set_owner_attributes for has_one association if target exists.
2011-07-04 18:43:09 +02:00
Andrew White
9f7442a3ab
Use an instance variable to store the current masss assignment options
2011-07-04 06:47:42 +01:00
Vijay Dev
15f35c0ac0
Reversing the changes done in c278a2c while still resolving #1857 .
...
The changes broke bulk migration tests and were fixed in 4d256bc6;
however that brought back the issue of #1857 and so this commit goes
back to the original scenario and just adds change_table to the list
of methods which are to be recorded in the CommandRecorder. The
method_missing now delegates all calls to the underlying connection as
before.
2011-07-02 23:43:13 +05:30
Aaron Patterson
36d289ad24
a few minor performance improvements: fewer strings, fewer range objects, fewer method calls
2011-07-01 15:20:11 -07:00
Aaron Patterson
2ed8097058
calling super is super. if the other object is exactly equal, we can return early
2011-07-01 14:38:22 -07:00
Aaron Patterson
06c72c43ba
remove unused codes
2011-07-01 14:38:17 -07:00
Aaron Patterson
441d8ec130
reduce calls to owners_by_key and to read_attribute, respond_to? etc
2011-07-01 09:55:48 -07:00
Jon Leighton
cb99c8593a
Remove AssociationReflection#create_association and AssociationReflection#create_association! - they are not called from anywhere.
2011-06-30 23:39:58 +01:00
Jon Leighton
0e225ec583
Assign the association attributes to the associated record before the before_initialize callback of the record runs. Fixes #1842 .
2011-06-30 23:39:58 +01:00
Aaron Patterson
6a283d598f
match method signature of the superclass
2011-06-30 15:31:23 -07:00
Aaron Patterson
8e19a5dc4c
call super rather than delegating to the other objects equal? method
2011-06-30 15:31:22 -07:00
Aaron Patterson
2545da6dd6
just alias eql? to == for frewer method calls
2011-06-30 15:31:22 -07:00
Aaron Patterson
f7bd07b62a
only calculate method name once
2011-06-30 15:31:22 -07:00
Aaron Patterson
f261ef42cc
cache the plural name on the reflection so we do not pay pluralize costs on joins
2011-06-30 15:31:22 -07:00
Santiago Pastorino
35cdd256c0
Master version is 3.2.0.beta
2011-06-30 10:18:36 -03:00
Jon Leighton
4d256bc6b1
CommandRecorder should delegate in method_missing where possible. Fixes some tests in migration_test.rb under mysql. The problem was introduced in c278a2c5e109204ec8a47fcbfdfc327aad7996ce.
2011-06-30 00:47:35 +01:00
Jon Leighton
e9fa602e1c
Define to_ary on ActiveRecord::Base to return nil. Improve performance of Array#flatten under 1.9, see comment for details.
2011-06-30 00:20:54 +01:00
Oriol Gual
56ac32ad51
Fix case
2011-06-28 22:31:24 +02:00
Oriol Gual
2e0840dd04
Update reverse order with new Arel Nodes
2011-06-28 22:22:26 +02:00
Aaron Patterson
941d5c1f40
Merge pull request #1857 from vijaydev/irreversible-migration
...
IrreversibleMigration is not raised when a method not supported by reversible migrations is called in the change method of a migration
2011-06-28 12:05:19 -07:00
Aaron Patterson
a5cb5a5af6
Merge pull request #1860 from dmathieu/comparison
...
Allow comparison on model objects - Closes #1858
2011-06-28 11:46:25 -07:00
Aaron Patterson
26caf32949
remove useless assignment
2011-06-28 10:57:56 -07:00
Aaron Patterson
13e79eb6c3
lock_optimistically is typically true, so evaluate the common failure case first
2011-06-28 10:51:23 -07:00
Aaron Patterson
02f45d6e0c
reduce object allocation during AR instantiation
2011-06-28 10:22:39 -07:00
Aaron Patterson
9921eca51c
remove the check for needs_type_condition? because ensure_proper_type will pick up the type column
2011-06-27 20:44:39 -07:00
Aaron Patterson
4006e738ed
stop using && for the short circuit side effect
2011-06-27 18:16:01 -07:00
Aaron Patterson
4ec47cac10
let strings be converted to symbols inside the interpreter
2011-06-27 18:15:28 -07:00
Aaron Patterson
9152126110
avoice paying hash cost if there are no serialized attributes
2011-06-27 17:46:56 -07:00
Aaron Patterson
45b7209f1f
cache column defaults for AR object instantiation
2011-06-27 17:45:34 -07:00
Aaron Patterson
06d4247f02
AR object instantiation is ~30% faster in the simple case
2011-06-27 16:15:34 -07:00
Aaron Patterson
5ddb60f2b3
initialize instance variables
2011-06-27 14:47:11 -07:00
Aaron Patterson
997aed24be
default create_with_value to a hash so we can eliminate conditionals, add test surrounding create_with(nil) behavior
2011-06-27 14:18:49 -07:00
Vijay Dev
732690589e
minor changes
2011-06-27 00:12:39 +05:30
Damien Mathieu
eb22c51173
comparing different classes returns nil
2011-06-26 09:41:30 +02:00
Damien Mathieu
bc743dc1ce
allow comparison on model objects - Closes #1858
2011-06-26 09:41:08 +02:00
Vijay Dev
532c294dea
replace find(all) with all
2011-06-26 02:24:35 +05:30
Vijay Dev
5a79ca660a
fix typo in method name
2011-06-25 18:47:51 +05:30
Vijay Dev
2332aa6e18
Revert "add missing methods supported by reversible migrations using the change method"
...
This reverts commit 7f91eebae361f2f3a1558f6d899b372524509a2d.
Reason: Incorrect documenting. The newly added methods to the list are
not actually supported by reversible migrations.
2011-06-25 18:45:41 +05:30
Vijay Dev
c278a2c5e1
record unsupported methods in CommandRecorder instead of letting the unsupported methods go through to the underlying db causing errors like duplicate columns to occur when rolling back migrations
2011-06-25 17:17:02 +05:30
Santiago Pastorino
d6413f043c
Merge pull request #1848 from raviolicode/postgresql_order_multiple_params
...
Fix for complex ordering of multiple columns on postgresql
2011-06-24 13:09:33 -07:00
Lucia Escanellas
9734a416fa
Improve ordering of multiple columns on postgresql
...
* Only on postgresql, order("first asc, second asc") was invalid
* Closes #1720
2011-06-24 13:37:08 -03:00
Vijay Dev
7f91eebae3
add missing methods supported by reversible migrations using the change method
2011-06-24 12:31:14 +05:30
Jon Leighton
87d6865bf7
Apply the default scope earlier when doing calculations. Fixes #1682 .
2011-06-23 19:57:49 +01:00
Ken Collins
b9bfb916e4
Update SQL Server db related rake tasks.
...
* Uses open source smoscript since scptxfr came out in 2000.
* Uses sqlcmd which replaces osql.
* Takes advantage of host/user/pass passed down by TinyTDS.
2011-06-23 12:41:39 -04:00
Jon Guymon
618300f05a
Log instrumentation name for exists? queries
2011-06-22 13:41:34 -07:00
Aaron Patterson
09866cef17
Merge pull request #1790 from ernie/reverse_sql_order_fix
...
Support reversal of ARel orderings in reverse_sql_order
2011-06-22 08:30:52 -07:00
Caius Durling
96be08de25
Stop find_in_batches using the records after yielding.
...
Currently if the code that calls .find_in_batches modifies the yielded array in place then .find_in_batches can enter an infinite loop searching with ruby object ids in the database instead of the primary key of records in the database. This happens because it naively assumes the yielded array hasn't been modified before calling #id on the last object in the array. And ruby (1.8 at least) alias' #id to #object_id so an integer is still returned no matter what the last object is.
By moving finding the #id of the last object before yielding the array it means the calling code can do whatever it wants to the array in terms of modifying it in place, and .find_in_batches doesn't care.
2011-06-21 19:55:21 +01:00
Aaron Patterson
ceb5bbbafc
Merge pull request #1632 from tardate/pg_schema_fu
...
Improving PostgreSQL adapter schema-awareness
2011-06-21 10:22:20 -07:00
Ernie Miller
08f3f30994
Support reversal of ARel orderings in reverse_sql_order
2011-06-20 14:15:19 -04:00
José Valim
89b3293a54
Merge pull request #1784 from gazay/3-1-stable-shadowing-variables
...
Removing shadowing outer local variables warnings
2011-06-20 06:48:17 -07:00
Alexey Gaziev
93f488e7fa
Removed shadowing variable warning in activerecord railties
2011-06-20 17:28:59 +04:00
Daniel Azuma
140ba34aa9
Add missing require 'set'
2011-06-20 00:24:35 -07:00
José Valim
7d4606156b
Merge pull request #1763 from grantneufeld/schema_column_exists_options_hash
...
Fix default options argument on ActiveRecord::ConnectionAdaptors::Table#column_exists?
2011-06-18 19:34:39 -07:00
Paul Gallagher
2b3d67fdaf
Merge remote branch 'rails/master' into pg_schema_fu
2011-06-19 10:21:15 +08:00
Paul Gallagher
b0d59907f7
Make PostgreSQL adapter view-compatible
...
* amongst other things, allows meta_search to run against view-backed models
2011-06-19 10:14:17 +08:00
Steve Hodgkiss
50444204cc
Fix inconsistencies by being polite to the wrapped body. Needed for Rack::Sendfile to function properly. See issue #1761 .
2011-06-18 22:30:01 +01:00
Grant Neufeld
3cc83a8f24
Changed the default value for the options argument on ActiveRecord::ConnectionAdapters::Table#column_exists? from nil to an empty Hash {}.
...
That method calls through to ActiveRecord::ConnectionAdapters::SchemaStatements##column_exists? expects options to be a Hash.
When options was nil, an error would occur in cases where the column did exist because the called method attempted to perform a key lookup on options.
2011-06-18 14:38:38 -06:00
Xavier Noria
146ec2d1df
Merge branch 'master' of git://github.com/lifo/docrails
2011-06-18 10:11:47 +02:00
Lucia Escanellas
144a388dec
Update remove_index documentation
...
* Changes should better reflect present code behavior
* Related to issue: https://github.com/rails/rails/issues/1624
2011-06-17 16:30:40 -03:00
Guillermo Iguaran
301cad4476
Bump to mysql2 0.3.6
2011-06-17 11:27:37 -05:00
Aaron Patterson
ba1b88fda6
Merge pull request #1636 from metaskills/upstream/3-1-stable
...
Allow the connection pool's #table_exists? method to give the connections
2011-06-17 00:02:45 -07:00
Jon Leighton
be99ae78c9
Perf fix - Use an instance variable instead of a class_attribute. Thanks @josevalim and @jhawthorn for the prompting.
2011-06-16 21:13:56 +01:00
Arun Agrawal
536e1566b6
Bump mysql2 to 0.3.5
2011-06-16 10:45:58 +05:30
Santiago Pastorino and José Ignacio Costa
e445a79562
Bump mysql2 up
2011-06-16 01:05:45 -03:00
Andrew White
5d655aabcb
Pass mass-assignment options to nested models - closes #1673 .
2011-06-13 13:02:51 +01:00
Jon Leighton
c52520166b
Make assert_no_queries literally enforce that there are no queries. As in, not a single line of SQL should be sent to the database, not even stuff that is ignored by assert_queries. The argument being that if you write assert_no_queries, you really do not want there to be any queries.
2011-06-12 18:50:24 +01:00
Jon Leighton
232c66a1ba
If we're going to use a global variable, let's at least namespace it
2011-06-12 18:38:39 +01:00
Jon Leighton
b09bbdb8bf
Replace inline lambdas with named methods
2011-06-12 18:19:22 +01:00
Jon Leighton
de01a64102
Move BEGIN and COMMIT into IGNORED_SQL rather than having them as a special case in assert_queries
2011-06-12 18:19:21 +01:00
benedikt
fa8dfad765
Don't wrap operations on collection associations in transactions when they are not needed, so the connection adapter does not send empty BEGIN COMMIT transactions blocks to the database.
2011-06-12 18:19:21 +01:00
Guillermo Iguaran
657ba2a9f0
Remove trailing whitespaces
2011-06-12 10:31:21 -05:00
Paul Gallagher
f8c4b374c8
make extract_schema_and_table a private method
2011-06-11 18:34:09 +08:00
Paul Gallagher
1d7c751bf7
remove table quoting in primary_key method
...
* add/cleanup tests
2011-06-11 02:21:24 +08:00
Ken Collins
c791e2d034
Allow the connection pool's #table_exists? method to give the connections #table_exists? method a chance.
2011-06-10 13:15:58 -04:00
Paul Gallagher
019c263633
apply private method indentation convention
...
* tidy test code and fix my typo
2011-06-10 22:48:58 +08:00
Paul Gallagher
5c7f8c929b
Improve PostgreSQL adapter schema-awareness
...
* table_exists? scoped by schema search path unless schema is explicitly named. Added tests and doc to clarify the behaviour
* extract_schema_and_table tests and implementation extended to cover all cases
* primary_key does not ignore schema information
* add current_schema and schema_exists? methods
* more robust table referencing in insert_sql and sql_for_insert methods
2011-06-10 21:52:25 +08:00
Brian Quinn
9f2e91414f
Ensure engine migrations are copied in the same sequence that they are required.
2011-06-10 12:11:45 +01:00
Damien Mathieu
84f71e42b7
don't reinitialize the arel_table unless the table_name changes
2011-06-09 14:56:07 -07:00
José Valim
af3f0b6204
Merge pull request #1591 from smartinez87/unused
...
Fix "warning: assigned but unused variable" on AR tests
2011-06-08 23:36:49 -07:00
Sebastian Martinez
0b86ac244c
Remove unused 'quoted_column_names' variable.
2011-06-08 23:13:43 -03:00
Rodrigo Navarro
8166e4b0c3
No need to create a new Arel::Table, as the arel_table method already creates a new one
2011-06-08 16:56:01 -03:00
Santiago Pastorino
1d3618a9b4
remove warning: assigned but unused variable
2011-06-08 00:26:09 -03:00
Jon Leighton
7d1782a2c1
Allow polymorphic has_one to work when the association is set before the owner has been saved. Fixes #1524 .
2011-06-08 00:32:49 +01:00
Jon Leighton
4f5f6a3257
When you add a record to a polymorphic has_one, you should be able to access the owner from the associated record
2011-06-08 00:32:49 +01:00
Dmitriy Kiriyenko
7c1f73c843
Do not use default_scope in ActiveRecord::Persistence#touch.
2011-06-07 18:42:40 +01:00
Xavier Noria
5e21247131
Merge branch 'master' of git://github.com/lifo/docrails
...
Conflicts:
activerecord/RUNNING_UNIT_TESTS
2011-06-06 22:23:30 +02:00
Vijay Dev
5d8df14d6d
comment the recorder methods
2011-06-07 01:38:03 +05:30
Vijay Dev
428883b579
up and down are no longer class methods in a migration
2011-06-07 01:23:08 +05:30
Guillermo Iguaran
c2c8ef57d6
Remove trailing white-spaces
2011-06-05 10:34:40 -05:00
Andrew White
54883682de
Don't double assign attributes - closes #1467 .
2011-06-03 13:57:00 +01:00
Vijay Dev
6e02164e02
styling changes
2011-06-02 01:08:14 +05:30
Ayose
196c8f13bf
Edited activerecord/lib/active_record/transactions.rb via GitHub
2011-06-01 12:36:16 -07:00
Brian Mathiyakom
1e43bd9f35
Fix issue #1272
...
Set reverse_order_value when asked to reverse_order().
Do the actual reversal in build_arel.
2011-06-01 18:29:29 +01:00
Ayose
3523144ea4
The URL http://dev.mysql.com/doc/refman/5.0/en/savepoints.html is no longer available
2011-06-01 08:47:06 -07:00
Andrew White
cf3364a03c
Raise NameError instead of ArgumentError in ActiveSupport::Dependencies
...
ActiveSupport::Dependencies now raises NameError if it finds an existing
constant in load_missing_constant. This better reflects the nature of
the error which is usually caused by calling constantize on a nested constant.
Closes #1423
2011-06-01 01:16:20 +01:00
Josh Kalderimis
eb7ef2ccd6
added an alias for new to build to the AR collection proxy, this corrects an issue where the collection proxies were not consistent
2011-06-01 00:01:35 +01:00
Jon Leighton
4067d88df5
Revert "[activerecord][postgresql] verify if table has a schema(not public)". This caused a test breakage. See #1410 for details.
...
This reverts commit c44418ea4e09cc81da47edbc9ac5f31c7e32c1b4.
2011-05-31 22:46:13 +01:00
Jon Leighton
fbe012e92d
Ensure that calculations properly override the select value even if it's set in the default scope. Fixes #1395 .
2011-05-31 21:12:20 +01:00
Jon Leighton
dfaad4f5a7
Only save the record once when calling create! on a collection association. Fixes #1360 .
2011-05-31 20:32:09 +01:00
Jon Leighton
60cb96abea
Implementing @dmathieu's cleaner fix from #1425 . Unfortunately he deleted the branch so I cannot just merge it.
2011-05-31 18:34:27 +01:00
Arun Agrawal
2e57b66931
Adding comment to work with 1.8.7. Nested Attribute fix.
2011-05-31 12:12:19 +05:30
Arun Agrawal
cfb5f1b608
Fix nested attribute for memory record.
2011-05-31 11:31:10 +05:30
Aaron Patterson
7278547a5d
Merge pull request #1410 from lucasts/pg_schema
...
a little step to better postgresql schema support in rails
2011-05-30 13:30:07 -07:00
Lee Reilly
4f234bfd79
Corrected some typos and American vs. Queen's English issues
2011-05-29 12:40:24 -07:00
Aaron Patterson
18b153d15d
Merge pull request #1384 from amatsuda/simplify_drop_table
...
Remove unused options from drop_table
2011-05-28 13:36:40 -07:00
Akira Matsuda
bcb466c543
No need to pass options which is never used
2011-05-29 04:30:22 +09:00
Akira Matsuda
d8f4988867
No need to override for just calling super
2011-05-29 04:29:19 +09:00
Vijay Dev
995ea00328
Use change in place of up and down in sessions table migration
2011-05-28 21:59:54 +05:30
Aaron Patterson
c122c7b271
stop using boolean expressions because of the side effects
2011-05-27 14:53:20 -07:00
Aaron Patterson
4b536f7591
Merge pull request #1365 from gnufied/sqlite3
...
close statment only if its not closed
2011-05-27 14:40:32 -07:00
Aaron Patterson
2a9b3abe19
Merge pull request #1229 from workmad3/master
...
Fix for Issue #1205
2011-05-27 14:34:05 -07:00
Hemant Kumar
ed1a0672ab
delegate connection and column_hash calls directly to model
2011-05-28 03:00:11 +05:30
Hemant Kumar
d48add714d
close statment only if its not closed
2011-05-28 02:57:36 +05:30
Aaron Patterson
985ace4d7f
work around bug in the sqlite3 bindings. fixes #1289
2011-05-27 14:12:28 -07:00
Lucas Stephanou
c44418ea4e
[activerecord][postgresql] verify if table has a schema(not public)
2011-05-27 17:48:34 -03:00
Lucas Stephanou
055c6fb010
find sequences with pg schemas properly
2011-05-27 16:39:19 -03:00
Sebastian Martinez
dfba8f544b
Fix font styling on associations.rb
2011-05-26 17:51:20 -03:00
Jon Leighton
602fff1f58
Merge pull request #1323 from fx/association_primary_key
...
use association_primary_key in AssociationScope#add_constraints
2011-05-26 13:08:10 -07:00
Jon Leighton
09e431aa89
Merge pull request #1318 from TheEmpty/master
...
Resolve issue #534
2011-05-26 12:54:38 -07:00
John Mileham
043b624390
Don't merge base opts into includes when serializing ARs
...
Conflicts:
activerecord/lib/active_record/serialization.rb
2011-05-26 11:40:57 -04:00
Marian Rudzynski
1f7c3d0264
use association_primary_key in AssociationScope#add_constraints
2011-05-26 11:00:27 +02:00
Mohammad El-Abid
ec44763f03
Removes the restriction on primary key when joining in a habtm && test that it was properly removed
2011-05-26 00:54:51 -04:00
Xavier Noria
b7921f50e7
Merge branch 'master' of github.com:rails/rails
2011-05-25 22:49:23 +02:00
Xavier Noria
00e1d0832e
Merge branch 'master' of git://github.com/lifo/docrails
...
Conflicts:
actionmailer/lib/action_mailer/base.rb
activesupport/lib/active_support/core_ext/kernel/requires.rb
2011-05-25 22:48:47 +02:00
Aaron Patterson
6b436c23a9
Merge pull request #1285 from joshk/remove_active_record_deprecations
...
removed deprecated methods, and related tests, from ActiveRecord
2011-05-25 13:48:35 -07:00
Franck Verrot
b2db8740ea
Fix the AR::Base#inspect method [ closes #1294 ]
2011-05-25 13:54:38 +02:00
Arun Agrawal
5d89675099
Database.rake file fixed for load_generators
2011-05-25 13:57:44 +05:30
Josh Kalderimis
542114e1d8
removed deprecated methods, and related tests, from ActiveRecord
2011-05-25 02:29:32 +02:00
José Valim
52e01fc59d
Everyone receives app as argument for consistency.
2011-05-25 01:37:55 +02:00
Jon Leighton
c69111ba5f
Fix infinite recursion where a lazy default scope references a scope. Fixes #1264 .
2011-05-25 00:08:14 +01:00
Jon Leighton
ce37f747cd
Merge pull request #1254 from pixeltrix/ignore-includes-in-through-scope
...
Ignore :includes on through associations
2011-05-24 15:34:28 -07:00
Jon Leighton
a000ff7a50
Ensure that the surrounding code in Relation#to_a respects the default_scope (as well as having Relation#arel respect the default scope). Fixes #1233 .
2011-05-24 23:29:44 +01:00
Aaron Patterson
176883a906
rescue record invalid exceptions and return false from the save method. fixes #796
2011-05-24 11:22:11 -07:00
Jeremy Friesen
f2a0dfc298
Addresses an inconsistency in the ActiveRecord::Base.method_missing handling of dynamic finder methods and the passing of the &block parameter for :find_by_attributes.
2011-05-24 13:52:48 -04:00
dmathieu
79dc275b8d
properly reference yml alias nodes
...
as per the last version of the yml specifications : http://www.yaml.org/spec/1.2/spec.html# * alias//
2011-05-24 11:18:28 +02:00
Andrew White
d8bd19f6ab
Ignore :includes on through associations
2011-05-24 07:21:32 +01:00
Sebastian Martinez
0034b7822d
Remove extra white spaces on ActiveRecord docs.
2011-05-23 20:58:25 -03:00
Sebastian Martinez
05f29ca2c9
Remove extra white-space on some exception messages.
2011-05-23 20:53:18 -03:00