aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/attribute_methods_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove not used require and some useless test commentsCarlos Antonio da Silva2012-11-171-12/+3
|
* Fix typo in module name and make #in_time_zone privateCarlos Antonio da Silva2012-11-171-1/+1
|
* Extract #in_time_zone helper method duplication to a moduleCarlos Antonio da Silva2012-11-171-12/+2
|
* Simplify helper method in attribute methods testCarlos Antonio da Silva2012-11-171-3/+1
|
* AR::AttributeMethods#[] raises AM::AttributeMissingError for missing attributes.Francesco Rodriguez2012-10-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | This fixes the following behaviour: class Person < ActiveRecord::Base belongs_to :company end # Before: person = Person.select('id').first person[:name] # => nil person.name # => ActiveModel::MissingAttributeError: missing_attribute: name person[:company_id] # => nil person.company # => nil # After: person = Person.select('id').first person[:name] # => ActiveModel::MissingAttributeError: missing_attribute: name person.name # => ActiveModel::MissingAttributeError: missing_attribute: name person[:company_id] # => ActiveModel::MissingAttributeError: missing_attribute: company_id person.company # => ActiveModel::MissingAttributeError: missing_attribute: company_id Fixes #5433.
* Revert "Key the attributes hash with symbols"Jon Leighton2012-10-121-2/+2
| | | | | | | | | | | | This reverts commit 86c3dfbd47cb96af02daaa655963292b1a1b110e. Conflicts: activerecord/lib/active_record/attribute_methods/read.rb Reason: whilst this increased performance, it also presents a DoS risk via memory exhaustion if users were allowing user input to dictate the arguments of read/write_attribute. I will investigate alternative ways to cut down on string allocations here.
* test cleanup, remove ruby_type because it's no longer neededYves Senn2012-09-031-1/+1
| | | | | All tests with a custom inheritance_column use the `Vegtable` model. The field ruby_type on the Company models is no longer needed
* Key the attributes hash with symbolsJon Leighton2012-08-311-2/+2
| | | | | | | | This is a performance/GC optimisation. In theory, this could be optimised by the implementation (last time I checked, this would have no effect on JRuby). But in practise, this make attribute access faster.
* Move the serialized attribute tests to their own fileRafael Mendonça França2012-08-261-11/+0
|
* Move test to the correct fileRafael Mendonça França2012-08-261-0/+6
|
* Refactor missing parameter validation based on positionCarlos Antonio da Silva2012-08-181-1/+0
|
* load active_support/core_ext/object/inclusion in active_support/railsXavier Noria2012-08-021-1/+0
|
* Deprecate ActiveRecord::Base.scoped.Jon Leighton2012-07-271-4/+4
| | | | | | | It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders.
* Fix class_eval without __FILE__ and __LINE__.kennyj2012-07-181-1/+1
|
* Move newly added multiparameter tests to base_test fileCarlos Antonio da Silva2012-06-281-35/+1
| | | | | All other multiparameter assignment tests are in the same file, so it makes sense to have all of them here.
* Skip test_setting_time_attribute because Oracle databaseYasuo Honda2012-06-281-0/+2
| | | | does not have TIME data type.
* Fixes #6825, adds tests covering cases and error possibilities, also changes ↵Mauricio Linhares2012-06-271-0/+33
| | | | SQLite3 driver to correctly generate a time column instead of datetime
* Remove unused assignments from activerecord testsMark Rushakoff2012-04-291-2/+2
|
* %s/find(:\(first\|last\|all\), \([^()]*\))/scoped(\2).\1/gcI amongst other ↵Jon Leighton2012-04-271-4/+4
| | | | things
* remove calls to find(:first), find(:last) and find(:all)Jon Leighton2012-04-261-1/+1
|
* attribute_present? should return false for empty stringsJacob Green2012-03-061-0/+3
|
* Fix warning: assigned but unused variablekennyj2012-03-011-3/+0
|
* force datetime attributes to be changed, fix GH #3965Sergey Nartimov2012-02-281-0/+13
|
* move id_before_type_cast to PrimaryKey moduleSergey Nartimov2012-02-161-0/+8
|
* Revert PR#5001 "removed unuseful require for reply as we are not using ↵Vishnu Atrai2012-02-121-0/+1
| | | | | | require model" This reverts commit 7381596ea32aff47222af89e4bc66000f4597acb.
* removed unuseful require for reply as we are not using require modelKarunakar (Ruby)2012-02-111-1/+0
|
* fixing the list of cached columnsAaron Patterson2012-02-091-1/+3
|
* only exclude serialized columns from cacheable columnsAaron Patterson2012-02-091-1/+1
|
* Test that #[] and #[]= keep working when #read_attribute and ↵Tom Stuart2012-01-111-0/+33
| | | | #write_attribute are overridden
* Test ActiveRecord::Base#[]= as well as #write_attributeTom Stuart2012-01-111-1/+7
|
* Fix #4046.Jon Leighton2011-12-231-0/+20
|
* remove deprecated underscore versions of attribute methodsSergey Nartimov2011-12-211-8/+0
|
* handle not only strings in date type castSergey Nartimov2011-12-191-0/+8
|
* Stop the build asploding on 1.8.7Jon Leighton2011-12-141-0/+4
|
* Fix #3837.Jon Leighton2011-12-031-0/+12
| | | | | We also need to time zone convert time zone aware attributes when accessed via read_attribute, not only when via direct access.
* Get rid of the underscore versions of attribute methods!Jon Leighton2011-12-011-0/+5
| | | | This makes me happy!
* don't alter global state in testJon Leighton2011-11-301-2/+3
|
* If the table behind has no primary key, do not ask again and just return nil.Julius de Bruijn2011-11-301-0/+5
|
* omg computer science!Jon Leighton2011-11-301-5/+1
| | | | | | | Implement a mini state machine for serialized attributes. This means we do not have to deserialize the values upon initialization, which means that if we never actually access the attribute, we never have to deserialize it.
* Use inheritance to avoid special-case code for the 'id' methodJon Leighton2011-11-301-1/+1
|
* Update ActiveRecord#attribute_present? to work as documentedJustin Mazzi2011-11-051-0/+18
| | | | | | | "Returns true if the specified attribute has been set by the user or by a database load and is neither nil nor empty?" Fixes #1613
* Stop trying to be clever about when to define attribute methods.Jon Leighton2011-09-141-24/+0
| | | | | | | | | There is no meaningful performance penalty in defining attribute methods, since it only happens once. There is also no reason *not* to define them, since they get thrown in an included module, so they will not 'overwrite' anything. In fact, this is desirable, since it allows us to call super.
* Deprecate using method_missing for attributes that are columns.Jon Leighton2011-09-131-0/+15
| | | | | | This shouldn't ever happen unless people are doing something particularly weird, but adding a deprecation in case there are bugs not caught by our tests.
* Let Ruby deal with method visibility.Jon Leighton2011-09-131-3/+3
| | | | | | Check respond_to_without_attributes? in method_missing. If there is any method that responds (even private), let super handle it and raise NoMethodError if necessary.
* Always generate attribute methods on the base class.Jon Leighton2011-09-131-0/+16
| | | | | | | | | | | | | | This fixes a situation I encountered where a subclass would cache the name of a generated attribute method in @_defined_class_methods. Then, when the superclass has it's attribute methods undefined, the subclass would always have to dispatch through method_missing, because the presence of the attribute in @_defined_class_methods would mean that it is never generated again, even if undefine_attribute_methods is called on the subclass. There various other confusing edge cases like this. STI classes share columns, so let's just keep all the attribute method generation state isolated to the base class.
* Revert "Merge pull request #2543 from htanata/unused_require_in_ar_test"Santiago Pastorino2011-08-161-0/+1
| | | | | This reverts commit 87152f2604e73b218df90befda576f0acfed0bbf, reversing changes made to 0d3615f04c79f6e90d8ab33fdfc920b8faac9cb8.
* Remove unused require.Hendy Tanata2011-08-161-1/+0
|
* Resolve warnings by instantizing @attrubtes as nilBrian Cardarella2011-07-301-0/+1
|
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.