Jon Leighton
e01dfb27fc
Undo performances regressions I introduced in bbe0a507f2 and add test for an edge case. Add comments to explain the intent of the code.
2011-04-15 13:09:12 +01:00
Jon Leighton
bbe0a507f2
Remove unnecessary code from define_read_method and add assertion to make sure the underscored version is actually generated
2011-04-15 01:44:27 +01:00
Prem Sichanugrist
733bfa63f5
Remove #among? from Active Support
...
After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now.
It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
2011-04-13 20:25:28 +08:00
David Heinemeier Hansson
d1575ae1b9
Change Object#either? to Object#among? -- thanks to @jamesarosen for the suggestion!
2011-04-12 00:23:07 +02:00
Prem Sichanugrist
a9f3c9da01
Using Object#in? and Object#either? in various places
...
There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
2011-04-11 03:17:09 +08:00
Aaron Patterson
a9d27c04ab
cleaning up typecast test a little
2011-03-26 17:16:33 -07:00
Aaron Patterson
5013fe3a1d
refactoring tz to a variable rather than repeating it
2011-03-26 17:04:54 -07:00
Aaron Patterson
dea3d2dd20
adding a test for attributes after type cast. thanks nragaz. ❤️
2011-03-26 11:50:31 -07:00
Aaron Patterson
7333f50abc
fixing whitespace errors. 💣
2011-03-25 12:10:11 -07:00
Adam Meehan
c5908a8649
Fix before_type_cast for timezone aware attributes by caching converted value on write. Also remove read method reload arg on timezone attributes.
2011-03-23 15:38:51 -07:00
Raimonds Simanovskis
c567ccbb17
bugfix for serialized_attributes to be class specific
...
previously serialized_attributes were kept as class attribute of ActiveRecord::Base - if some attribute was defined as serialized in one subclass then it was serialized in all other subclasses as well (if it had the same name)
2011-02-09 09:19:56 -08:00
Akira Matsuda
65e08cfb4f
do not to_s where you are testing that a string value is stored for the before_type_cast
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2011-02-07 09:52:24 -02:00
Akira Matsuda
40aefb9301
avoid nil.dup
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2011-02-07 09:51:51 -02:00
Raimonds Simanovskis
9e23835cb8
fix for test_read_attributes_before_type_cast_on_datetime - Oracle adapter also returns Time value
2011-02-02 09:06:42 -08: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
Jeremy Kemper
63ed6ca998
Add test for e0e3adf
2011-01-07 16:25:25 -08:00
Santiago Pastorino
304d38c053
Allow primary_key to be an attribute when the model is a new record
2010-12-28 10:11:27 -02:00
Aaron Patterson
077ec5a0ed
fixing space errors
2010-12-02 08:45:37 -08:00
Michael Koziarski
96eec090df
Work around a strange piece of Syck behaviour where it checks Model#respond_to? before initializing the object.
...
Things like YAML.load(YAML.dump(@post)) won't work without this.
2010-12-02 08:40:34 -08:00
Aaron Patterson
2738ec891b
removing many unused variables
2010-11-16 17:06:50 -08:00
Aaron Patterson
77b1193ac1
mysql tests are mostly passing
2010-10-26 13:44:08 -07:00
Jeremy Kemper
d79b1aa0ba
Fewer object allocations
2010-09-09 14:37:58 -07:00
Jeremy Kemper
4b7b8d9e19
Cache unserialized attributes
2010-09-09 14:37:57 -07:00
Raimonds Simanovskis
8f171b4d69
Do not use time zone in test_read_attributes_before_type_cast_on_datetime for Oracle database
...
As currently string_to_time method is not doing time zone conversion to database time zone
2010-08-22 16:35:55 -07:00
Santiago Pastorino
59a0700b56
Both tests are using the same model, move the model to another file and add the missing require
2010-08-14 18:48:06 -03:00
Santiago Pastorino
b451de0d6d
Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;)
2010-08-14 04:12:33 -03:00
Brian Lopez
94cff67bd1
ignore this test for mysql2
2010-08-09 12:50:09 -07:00
Neeraj Singh
807239f5a1
Making Active Record base_test.rb thinner by moving tests
...
to relevant files.
Number of assertions before refactoring:
2391 tests, 7579 assertions, 0 failures, 0 errors
Number of assertions after refactoring:
2391 tests, 7579 assertions, 0 failures, 0 errors
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-08-03 10:45:54 +02:00
Neeraj Singh
b462952886
Use better assertion methods for testing
...
[#4645 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-05-19 10:18:36 +02:00
Raimonds Simanovskis
71c32d3cac
1=2 is invalid expression in Oracle SELECT
2009-08-06 23:40:59 +03:00
Joshua Peek
f8d3c72c39
Extract generic attribute method generation to AMo
2009-08-04 23:36:05 -05:00
Paul Gillard
c30a0ce3c8
Modified ActiveRecord::AttributeMethods to allow classes to specify attribute method prefixes and/or suffixes. Previously only suffixes were allowed.
...
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2009-08-04 16:19:19 -05:00
Joshua Peek
2c30c9fe6c
Undefine id and let it automatically be generated
2009-07-30 17:54:01 -05:00
Joshua Peek
3e58f8e191
Restore DangerousAttributeError
2009-07-30 17:54:00 -05:00
Joshua Peek
94dabf9b4b
Generate methods for all suffixes
2009-07-30 17:54:00 -05:00
Sam Goldstein
d60d7edce4
Make it so AR attributes which conflict with object-private methods (e.g. system) don't 'randomly' cause NoMethodErrors
...
Previously if you called this attribute before others, you'd get exceptions. But if it was the second-or-subsequent attribute you retrieved you'd get the correct behaviour.
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#2808 state:committed]
2009-07-09 16:44:30 +12:00
Jeremy Kemper
1c36172c13
Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.
...
[#1617 state:resolved]
2009-03-08 13:11:58 -07:00
Max Lapshin
1fe9d6cc88
Support true/false in query_attribute for calculated columns
...
Signed-off-by: Tarmo Tänav <tarmo@itech.ee >
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2009-02-06 13:39:08 +13:00
Mike Gunderloy
5c97d4ff29
"raise NoMethodError" raises NoMethodError. Raise it with NoMethodError.new instead.
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-10-25 14:52:44 +05:30
Adam Milligan
4d9a7ab5f5
Changed ActiveRecord attributes to respect access control.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#1084 state:committed]
2008-09-24 19:40:07 +02:00
miloops
9c4730d01e
Base.skip_time_zone_conversion_for_attributes uses class_inheritable_accessor, so that subclasses don't overwrite Base [ #346 state:resolved]
2008-09-14 17:18:17 -05:00
Tarmo Tänav
656f0e7c6c
Fix file permissions
...
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2008-07-31 16:36:23 -05:00
Joshua Peek
c08547d226
Namespace Inflector, Dependencies, OrderedOptions, and TimeZone under ActiveSupport [ #238 state:resolved]
2008-06-03 13:32:53 -05:00
gbuesing
328fada610
ActiveRecord time zone aware attributes: blank string is treated as nil when assigned to writer
2008-05-08 20:31:54 -05:00
Scott Fleckenstein
eb5b93be74
Fix Time.zone.parse from stripping time zone information and make Time aware attribute methods use Time.zone.parse instead of to_time
2008-05-08 19:25:31 -05:00
Geoff Buesing
458fd10483
Removing unnecessary uses_tzinfo helper from tests, given that TZInfo is now bundled
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9150 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-30 23:01:06 +00:00
Geoff Buesing
54ccdd3343
Time, DateTime and TimeWithZone #in_time_zone defaults to Time.zone. Removing now unneeded #in_current_time_zone. ActiveRecord time zone aware attributes updated to use #in_time_zone
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9047 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-17 05:50:13 +00:00
Michael Koziarski
cfb8ba0003
Add uses_tzinfo to active record tests to prevent breaking the cc.rb build etc. Closes #11034 [mpalmer]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8808 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-06 22:26:47 +00:00
Rick Olson
72385a7be6
Add Time Zone support to ActiveRecord, and config.time_zone property for specifying a default Time Zone. Closes #10982 [Geoff Buesing, rick]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8806 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-06 06:43:02 +00:00
Jeremy Kemper
39814fcce0
Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/rails
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-21 17:20:51 +00:00