Commit Graph

2514 Commits

Author SHA1 Message Date
Emilio Tagua
39e4e76d15 Merge commit 'rails/master'
Conflicts:
	activerecord/lib/active_record/associations.rb
2009-09-01 15:45:43 -03:00
José Valim
da636809da Assert primary key does not exist in habtm when the association is defined, instead of doing that everytime a record is inserted.
[#3128 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-01 10:15:23 -07:00
Josh Sharpe
80989437dc I added this feature so that a Map of changed fields could be retrieved
after a model had been saved. This is useful in the after_save callback
when you need to know what fields changed. At present there is no way
to do this other than have code in the before_save callback that takes
a copy of the changes Map, which I thought was a bit messy.

Example.

  person = Person.find_by_name('bob')
  person.name = 'robert'
  person.changes # => {'name' => ['bob, 'robert']}
  person.save
  person.changes # => {}
  person.previous_changes # => {'name' => ['bob, 'robert']}
  person.reload
  person.previous_changes # => {}

Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-31 12:50:27 -05:00
Emilio Tagua
6b67df70ab Revert "Revert "Add readonly support for relations.""
This reverts commit f2c0725d79.
2009-08-27 20:03:46 -03:00
Emilio Tagua
f2c0725d79 Revert "Add readonly support for relations."
This reverts commit 7cce95b25a.
2009-08-27 20:00:14 -03:00
Emilio Tagua
7cce95b25a Add readonly support for relations. 2009-08-27 18:52:14 -03:00
Emilio Tagua
d56e987757 No need to reload the relation table with a method param, just nil it. 2009-08-27 16:49:16 -03:00
Emilio Tagua
53f6c6d24e Performance: Don't reload ARel relation on update. 2009-08-27 16:46:24 -03:00
Emilio Tagua
e204f80dbb Performance: Don't reload the ARel relation on create, do it on
reset_column_information.
2009-08-27 16:42:57 -03:00
Emilio Tagua
1cc0ea826e Performance: Don't reload the arel_table when destroying. 2009-08-27 16:30:48 -03:00
Emilio Tagua
d395391e1d Merge commit 'rails/master' 2009-08-27 15:56:16 -03:00
Jeffrey Hardy
8c05ca96f8 Don't use AR::Base.connection for fixture column quoting. Use the connection given to Fixtures.new
[#3104 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-26 14:53:09 -07:00
Emilio Tagua
286f47f3b0 Remove useless var local definition. 2009-08-26 16:19:19 -03:00
Sven Fuchs
d672a14ee7 allow ActiveRecord#RecordInvalid exception message to be localized
[#2754 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-26 11:29:16 -07:00
Emilio Tagua
33746c44cb No need to create a new relation if the argument is blank. 2009-08-25 19:47:29 -03:00
Emilio Tagua
a60334fdc5 Remove useless conditionals/local var. 2009-08-19 19:36:06 -03:00
Emilio Tagua
54fcbb881d Make sure join association methods are called once. 2009-08-19 17:45:13 -03:00
Emilio Tagua
b32474020c Don't sanitize_sql where it doesn't make sense. 2009-08-19 16:29:26 -03:00
Emilio Tagua
ccf5f2c4a2 Remove old method and comment. 2009-08-19 16:17:16 -03:00
Emilio Tagua
3e1ef198e0 Remove useless InnerJoinDependency, inner joins are performed through
Arel::InnerJoin.
2009-08-19 16:08:54 -03:00
Emilio Tagua
2048556a14 Remove whitespace. 2009-08-19 11:09:12 -03:00
Emilio Tagua
c36cfa7568 Remove unused quoted_record_ids, now ARel does this using ARel::In. 2009-08-18 20:03:32 -03:00
Emilio Tagua
a09215ee96 has_many nullify associations keys using ARel. 2009-08-18 20:02:14 -03:00
Emilio Tagua
a7178773d2 Remove now unused quote_table_name, ARel does that quoting now. 2009-08-18 19:53:21 -03:00
Emilio Tagua
d5476b466f habtm insertion with ARel integration. 2009-08-18 19:51:41 -03:00
Emilio Tagua
c1f833dff4 habtm delete method integrated with ARel. 2009-08-18 19:38:34 -03:00
Emilio Tagua
0abba2813b Call to_sql method on ActiveRecord::Relation instance not it's relation
attribute.'
2009-08-18 19:38:03 -03:00
Emilio Tagua
74ed123e08 Override respond_to? in ActiveRecord::Relation to go with
method_missing.
2009-08-18 16:35:33 -03:00
Emilio Tagua
fefb4c78ac Cache arel_table when possible, use class method arel_table instead
instance method.
2009-08-18 16:28:04 -03:00
Emilio Tagua
0d6997b6e3 Cache #arel_able when possible. 2009-08-18 14:49:11 -03:00
Emilio Tagua
60926db9e0 Inline initializer setup. 2009-08-18 14:22:38 -03:00
Emilio Tagua
66fbcc1de6 Use immutable relation objects to generate queries. 2009-08-18 14:10:03 -03:00
Emilio Tagua
ac03bc91db Use explicit method definition instead of metaprogramming. 2009-08-18 08:27:37 -03:00
Emilio Tagua
fa8f5c2667 Relation#joins! should know what to join instead of delegating to
construct_join.
2009-08-18 08:18:24 -03:00
Emilio Tagua
79e951ca9b Use finder options as relation method names to provide more familiar
naming. Use bang methods convention in methods that alter the
relation.
2009-08-18 07:50:11 -03:00
Emilio Tagua
c923409630 Clean up relation joins when finding records with included associations. 2009-08-17 20:17:40 -03:00
Emilio Tagua
4b339f44bd Merge commit 'rails/master' 2009-08-17 19:46:32 -03:00
Pratik Naik
25e5b0c4a8 Remove support for SQLite 2.
If you're still using it, please install the plugin from git://github.com/rails/sqlite2_adapter.git
2009-08-17 14:54:34 +01:00
Emilio Tagua
770fca10fb Remove group when building the relation, it will be added later if
options[:group] is given.
2009-08-16 17:27:45 -03:00
Jay Pignata
cb3e669b0d Fix calculation tests on sqlite2 [#3053 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-15 19:14:11 -07:00
Emilio Tagua
796ec652ad Don't use regular rinder on calculations since scoping order blows
PostreSQL.
2009-08-14 15:59:55 -03:00
Emilio Tagua
48c1e6d584 Merge commit 'rails/master' 2009-08-14 12:34:38 -03:00
Emilio Tagua
9ac01fad19 Use ARel's joins when building a query for finding records with included
associations.
2009-08-14 12:33:05 -03:00
Joshua Peek
c6bc8e6626 Break up concerns for choosing what attributes should be serialized and the actual serializer 2009-08-13 22:27:36 -05:00
Emilio Tagua
10af9fae4a Merge commit 'rails/master' 2009-08-10 18:19:24 -03:00
Emilio Tagua
0e2fbd80e2 Merge commit 'rails/master'
Conflicts:
	activerecord/lib/active_record/calculations.rb
	activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
	activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
2009-08-10 18:07:33 -03:00
Pratik Naik
ad28e0037b Remove unnecessary scoping for creating hm:t join record 2009-08-10 21:20:01 +01:00
Pratik Naik
50b83984f1 Remove unnecessary scoping and validation checks from hm:t#create 2009-08-10 21:06:49 +01:00
Pratik Naik
d9c4087a9e Unify hm:t#create and create! implementation 2009-08-10 21:02:06 +01:00
Joshua Peek
f97dae5ebe Extract common dirty tracking methods in AMo 2009-08-10 13:51:48 -05:00