Commit Graph

4294 Commits

Author SHA1 Message Date
Xavier Noria
a96a9a4948 Merge branch 'master' of git://github.com/lifo/docrails 2011-02-02 22:04:11 +01:00
Aaron Patterson
8bfa8e7cbe this method should never return nil 2011-02-02 10:25:53 -08:00
Aaron Patterson
3fc598095e just require mysql2 2011-02-02 10:25:53 -08:00
Santiago Pastorino
12b2f8b040 Delete blank lines in migration generator 2011-02-02 16:20:03 -02:00
Aaron Patterson
70b9db173e adding mysql2 adapter 2011-02-02 10:17:39 -08:00
Franck Verrot
8dcacd0cc7 Refactor clear_timestamp_attributes to use the newly created all_timestamp_attributes_in_model
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 12:45:25 -02:00
Franck Verrot
a5b03e9c7a Implement and test private method all_timestamp_attributes_in_model
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 12:45:14 -02:00
Franck Verrot
5178e64175 Added timestamp_attributes_for_create_in_model
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 12:44:53 -02:00
Michał Łomnicki
4e39072017 Configurable generation of add_index for references columns
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-01 22:50:51 -02:00
Aaron Patterson
5b42e96602 make sure de-serialization happens on object instantiation 2011-02-01 15:23:55 -08:00
Aaron Patterson
a0fac71922 store the serialized column values in the @attributes hash 2011-02-01 14:25:47 -08:00
Aaron Patterson
ebe485fd8e serialize can take an arbitrary code object 2011-02-01 14:25:47 -08:00
Aaron Patterson
ee34b4cf34 share column cache among subclasses, only look up columns per AR::Base subclass once 2011-02-01 14:25:46 -08:00
Aaron Patterson
a6cf6ec98b move the coders to the serialized_attributes hash 2011-02-01 14:25:46 -08:00
Aaron Patterson
69600a9f97 avoid column lookup on subclasses, keep column info cached as table_name => column_list 2011-02-01 14:25:46 -08:00
Aaron Patterson
3cc2b77dc1 adding a YAML Column coder for YAML serialization to db columns 2011-02-01 14:25:46 -08:00
Aaron Patterson
0171de00b7 moving AR::ConnectionAdapters::Column to its own file 2011-02-01 14:25:46 -08:00
Aaron Patterson
65f11ff789 column will use coder to typecase value when it is available 2011-02-01 14:25:46 -08:00
Aaron Patterson
a7c2f6be30 coders can be assigned to columns 2011-02-01 14:25:46 -08:00
Aaron Patterson
2f62084d42 dry up our case / when statements 2011-02-01 14:25:46 -08:00
Santiago Pastorino
451ad38bb2 scope is always a Relation 2011-02-01 17:20:24 -02:00
Glenn Vanderburg
6bd9fac1e3 Propagate association extensions to scopes called on the association.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-01 12:38:58 -02:00
Akira Matsuda
817e370136 Make before_type_cast available for datetime fields
[#3973 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-01 12:21:18 -02:00
Paco Guzman
5a6f651a6a FIX not using _on_create or _on_update callbacks only _create and _update 2011-02-01 08:37:43 +01:00
Aaron Patterson
4ccf8319bb expand mulasgn for enhancing readability 2011-01-31 14:03:28 -08:00
John Firebaugh
57bc25c5f8 Use run_callbacks; the generated _run_<name>_callbacks method is not a public interface.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-01-31 19:45:53 -02:00
Pratik Naik
30176f28a4 Add :bulk => true option to change_table 2011-01-31 13:21:25 +00:00
Jon Leighton
9db4c07e0b Make use of helpers in AssociationReflection 2011-01-30 11:58:09 +00:00
Jon Leighton
3fa61ccb9e Has many through - It is not necessary to manually merge in the conditions hash for the through record, because the creation is done directly on the through association, which will already handle setting the conditions. 2011-01-30 11:58:09 +00:00
Jon Leighton
c5e912a8b3 @join_table_name is no longer used 2011-01-30 11:58:09 +00:00
Jon Leighton
59d54c3eba Make AssociationCollection#include? a bit more readable 2011-01-30 11:58:08 +00:00
Jon Leighton
0645fd2c80 Don't use method_missing when we don't have to 2011-01-30 11:58:08 +00:00
Jon Leighton
2e24cf7cc2 AssociationCollection#clear can basically just use #delete_all, except it should return self. 2011-01-30 11:58:08 +00:00
Jon Leighton
88df88095c AssociationCollection#to_ary should definitely dup the target! Also changed #replace which was previously incorrect, but the test passed due to the fact that to_a was not duping. 2011-01-30 11:58:08 +00:00
Jon Leighton
1da1ac159f Just use primary_key here, AR::Relation will resolve the ambiguity before it is converted to SQL 2011-01-30 11:58:08 +00:00
Jon Leighton
140b269fb7 Call sum on the scope directly, rather than relying on method_missing and calculate 2011-01-30 11:58:08 +00:00
Jon Leighton
ca7785847e Condense first_or_last a bit more 2011-01-30 11:58:08 +00:00
Jon Leighton
fdee153ff8 Get rid of separate reset_target! and reset_scopes_cache! methods 2011-01-30 11:58:08 +00:00
Jon Leighton
5dd3dadcdd target is always an array 2011-01-30 11:58:08 +00:00
Jon Leighton
47309826e4 load_target will return the target. it also will not load if loaded? is true. 2011-01-30 11:58:08 +00:00
Jon Leighton
b7bcc7e190 DRY up first/last and hence make last benefit from the bugfix in first 2011-01-30 11:58:08 +00:00
Jon Leighton
e8d7152a89 Use scoped.find directly rather than having a find_by_sql method 2011-01-30 11:58:07 +00:00
Jon Leighton
1a4bbaf106 Use scoped.first and scoped.last instead of find(:first, ...) and find(:last, ...) 2011-01-30 11:58:07 +00:00
Jon Leighton
1e7cf6c7e9 Try to make fetch_first_or_last_using_find? more readable 2011-01-30 11:58:07 +00:00
Jon Leighton
db503c4142 load_target returns the target 2011-01-30 11:56:41 +00:00
Jon Leighton
aa86420be2 Rename AssociationProxy#loaded to loaded! as it mutates the association 2011-01-30 11:56:41 +00:00
Jon Leighton
de05e2fb15 Abstract load_target conditional logic 2011-01-30 11:56:41 +00:00
Jon Leighton
d392c67d2c Remove unused methods conditions, sql_conditions and sanitize_sql 2011-01-30 11:56:41 +00:00
Jon Leighton
dbb6fa723e Don't pass around conditions as strings in ThroughAssociation 2011-01-30 11:56:41 +00:00
Jon Leighton
d85ee50eda Indent methods under private/protected sections 2011-01-30 11:56:41 +00:00