wycats
d916c62cfc
eliminate alias_method_chain from ActiveRecord
2010-05-09 02:37:52 +03:00
Josh Kalderimis
e17ff6d617
updated AR to work with the AMo model validation changes
2010-05-08 23:51:36 +03:00
José Valim
6626833db1
Revert "Add index length support for MySQL [ #1852 state:open]"
...
This commit breaks dumping a few tables, as the sessions table.
To reproduce, just create a new application and:
rake db:sessions:create
rake db:migrate
rake db:test:prepare
And then look at the db/schema.rb file (ht: Sam Ruby).
This reverts commit 5b95730edc .
2010-05-08 17:46:39 +03:00
Emili Parreno
5b95730edc
Add index length support for MySQL [ #1852 state:resolved]
...
Example:
add_index(:accounts, :name, :name => 'by_name', :length => 10)
=> CREATE INDEX by_name ON accounts(name(10))
add_index(:accounts, [:name, :surname], :name => 'by_name_surname', :length => {:name => 10, :surname => 15})
=> CREATE INDEX by_name_surname ON accounts(name(10), surname(15))
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2010-05-08 12:39:46 +01:00
Santiago Pastorino
9aaef59356
Make find_or_create and find_or_initialize work mixing explicit parameters and a hash [ #4457 state:committed]
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-05-07 09:40:02 -07:00
Ernie Miller
902861a43a
Fix unintuitive behavior with multiple order and group clauses
...
[#4545 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-05-06 16:00:39 -07:00
Mathieu Arnold
38da0ace77
Use primary key in conditions, not 'id' [ #4395 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2010-05-04 22:45:08 +01:00
Lawrence Pit
9bd91b00b8
Favor %{} in all code instead of (deprecated) {{}} as interpolation syntax for I18n
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-05-03 13:37:32 +02:00
Lawrence Pit
60504e62c8
to_xml with :include should skip_instruct on the included records [ #4506 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-04-30 14:22:57 +02:00
Neeraj Singh
883f27aa9a
test cases for record.to_xml [ #458 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-04-30 13:19:30 +02:00
Brian Durand
d2a49e4b1f
Update after_commit and after_rollback docs and tests to use new style API with an :on options instead of on_* suffix.
...
[#2991 ]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-04-29 18:26:19 -07:00
Brian Durand
da840d13da
Add after_commit and after_rollback callbacks to ActiveRecord that are called after transactions either commit or rollback on all records saved or destroyed in the transaction.
...
[#2991 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-04-29 12:24:15 -07:00
Neeraj Singh
f4d174b211
making rake:migrate VERSION=0 a noop called in succession. [ #2137 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-04-29 13:41:35 +02:00
José Valim
2e9af3638d
Move several configuration values from Hash to ActiveSupport::XmlMini, which both Hash and Array depends on.
...
Also, refactored ActiveModel serializers to just use ActiveSupport::XmlMini.to_tag. As consequence, if a serialized attribute is an array or a hash, it's not encoded as yaml, but as a hash or array.
2010-04-29 12:42:42 +02:00
Ernie Miller
e33d304975
Fix eager loading of associations causing table name collisions
...
[#4463 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-04-28 20:28:51 -07:00
Curtis Hawthorne
7e06494e32
Destroy respects optimistic locking.
...
Now works with :dependent => :destroy and includes unit tests for that
case. Also includes better error messages when updating/deleting stale
objects.
[#1966 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-04-27 21:53:51 -07:00
Andrew White
8ec085bf18
Support fixtures for namespaced models [ #2965 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-04-25 16:04:38 +02:00
Jeremy Kemper
bd3cc6bfff
Remove quoted_string_prefix entirely since PostgreSQL was the only database adapter relying on it.
2010-04-24 16:27:20 -07:00
Santiago Pastorino
c4846c99c5
Missing require added
2010-04-18 00:12:08 -03:00
Aaron Patterson
b7693dc028
working around syck defects by optionally matching a space [ #4426 state:resolved]
...
Signed-off-by: wycats <wycats@gmail.com >
2010-04-17 00:50:59 -04:00
Aaron Patterson
d92e3111fe
making yaml tests less specific to emitter. [ #4425 state:resolved]
...
Signed-off-by: wycats <wycats@gmail.com >
2010-04-17 00:41:10 -04:00
Aaron Patterson
cd6578f6a1
fixing invalid yaml [ #4424 state:resolved]
...
Signed-off-by: wycats <wycats@gmail.com >
2010-04-17 00:14:23 -04:00
Mislav Marohnić
c2ca73c9ee
ActiveModel::Observing: stop using Observable Ruby module, re-implement notify_observers
...
`Observable#notify_observers` from Ruby always returns false (which halts ActiveRecord
callback chains) and has extra features (like `changed`) that were never used.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-04-16 13:09:07 -07:00
Mislav Marohnić
cf616e4876
merge callbacks_observers_test.rb into lifecycle_test.rb where other observers test reside
...
Benefits: test able to run independently, subclassing instead of changing the original Comment model
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-04-16 13:09:07 -07:00
Aaron Patterson
779723a0b4
fix a failure and some warnings on 1.9.2 [ #4417 state:resolved]
...
Signed-off-by: Xavier Noria <fxn@hashref.com >
2010-04-16 09:03:42 -07:00
Pratik Naik
2ff5f38abb
Ensure not to load the entire association when bulk updating existing records using nested attributes
2010-04-14 01:52:29 +01:00
Andrew White
9cea9bc7f0
Refactor compute_type to handle situations where the correct class is already loaded
...
Signed-off-by: wycats <wycats@gmail.com >
2010-04-12 21:31:20 -07:00
Emmanuel Oga
f8eddcc735
make ActiveRecord::Base.subclasses a public method
...
Signed-off-by: wycats <wycats@gmail.com >
2010-04-12 21:20:45 -07:00
Phil Smith
bab1f910c7
table_name_prefix and table_name_suffix are class_attributes instead of cattr_accessors. [ #4230 ]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-04-12 10:59:38 +02:00
Aaron Patterson
ecf039fc05
mode postgresql adapters table_exists? method take the schema in to account. [ #4341 state:resolved]
...
Signed-off-by: wycats <wycats@gmail.com >
2010-04-11 14:53:24 -07:00
Aaron Patterson
61355c0e24
clearing up many warnings, removing unnecessary regular expresion comparisons [ #4365 state:resolved]
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-04-10 22:13:42 -07:00
mfoster
5850edf104
Made arrays of ActiveRecords, and any classes, with namespaces convert to valid xml. [ #3824 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-04-10 18:12:43 +02:00
Aaron Patterson
f46dc9b6b7
clear the rest of the warnings, run with warnings turned on [ #4332 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-04-10 13:50:38 +02:00
Aaron Patterson
922e4c57a4
kill warnings on 1.8.7 [ #4331 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-04-10 13:50:35 +02:00
Michael Koziarski
1e3dce08e1
Revert "When creating database with rake, create schemas in schema_search_path if it doesn't exist."
...
This reverts commit 6c2a0675f1 .
Reverting because it breaks the ability to run tests using a non-superuser.
Conflicts:
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
activerecord/lib/active_record/railties/databases.rake
2010-04-09 11:30:40 +12:00
Kristopher Murata
36129f21b8
Dirty datetime attributes should be aware of time zone info [ #3658 state:resolved]
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-04-08 10:26:16 -07:00
Pratik Naik
48634bf59a
Reset named scope cache whenever the @target is reset
2010-04-07 01:16:45 +01:00
Pratik Naik
1f7b4447a9
Memoize association.named_scope calls
2010-04-05 21:55:24 +01:00
Andrew White
98b4424141
Add tests to prevent regression of lazy evaluation of has_many ..., :dependent => :___
...
[#2627 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-04-04 07:00:24 -07:00
Pratik Naik
b77dd218ce
Add Relation extensions
2010-04-02 17:38:02 +01:00
Ernie Miller
98bf00d50d
Add tests for postgresql column type mapping updates [ #4270 state:resolved]
...
Signed-off-by: Emilio Tagua <miloops@gmail.com >
2010-03-31 19:22:54 -03:00
Pratik Naik
5562abb4e9
Dont try to load the record from the db if preloading didn't find anything
2010-03-31 12:56:09 +01:00
Emilio Tagua
37102a5237
Fix failing test in MySQL.
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-03-30 16:01:53 +02:00
Emilio Tagua
8d99ec9a4d
Named scopes shouldn't test equality using to_a if it's not an Array, this was causing records to be loaded before they were needed.
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-03-30 15:36:18 +02:00
José Valim
56bed512f9
Fix dom_id for ActiveRecord [ #4296 state:resolved]
2010-03-30 01:32:26 +02:00
Ernie Miller
63026541b2
Fix honoring :primary_key option when joining or eager loading a belongs_to association
...
[#765 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-03-29 15:24:27 -07:00
Emilio Tagua
53ddbfc460
Warn scoped order and limit are ignored. [ #4123 state:resolved]
2010-03-29 11:30:06 -03:00
Andrew White
67d1cec4c8
Add the ability to specify table_name_prefix on individual modules
...
Signed-off-by: wycats <wycats@gmail.com >
2010-03-28 23:43:28 -07:00
Matthew Rudy Jacobs
b0967cc5cf
defining a named_scope which overwrites an existing method is now allowed we just log a warning.
...
This was motivated by the fact that :open is defined on all classes
as such the named_scope "open" can never be used, without hacking
ActiveRecord with an "undef_method" [#4083 state:resolved]
Signed-off-by: wycats <wycats@gmail.com >
2010-03-28 13:53:20 -07:00
Rizwan Reza
f1e5a9ff98
Add :dependent = to has_one and has_many [ #3075 state:resolved]
2010-03-28 18:47:46 +04:30