aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/attribute_methods.rb
Commit message (Collapse)AuthorAgeFilesLines
* pass over the code commentsXavier Noria2013-04-281-28/+32
| | | | | | * Highlights the requirement of an attributes method. * Removes some details that depend on the implementation of the class including the module. * Applies guidelines here and there.
* prefer american spelling of 'behavior'Gosha Arinich2013-01-071-1/+1
|
* Replace some global Hash usages with the new thread safe cache.thedarkone2012-12-141-4/+5
| | | | | | | | | | | | | | | | Summary of the changes: * Add thread_safe gem. * Use thread safe cache for digestor caching. * Replace manual synchronization with ThreadSafe::Cache in Relation::Delegation. * Replace @attribute_method_matchers_cache Hash with ThreadSafe::Cache. * Use TS::Cache to avoid the synchronisation overhead on listener retrieval. * Replace synchronisation with TS::Cache usage. * Use a preallocated array for performance/memory reasons. * Update the controllers cache to the new AS::Dependencies::ClassCache API. The original @controllers cache no longer makes much sense after @tenderlove's changes in 7b6bfe84f3 and f345e2380c. * Use TS::Cache in the connection pool to avoid locking overhead. * Use TS::Cache in ConnectionHandler.
* cleanup, remove broken whitespaceYves Senn2012-11-251-2/+2
|
* Make caller attribute in deprecation methods optionalAlexey Gaziev2012-10-301-1/+1
|
* Provide a call stack for deprecation warnings where needed.Nikita Afanasenko2012-10-291-6/+5
| | | | It's sometimes hard to quickly find where deprecated call was performed, especially in case of migrating between Rails versions. So this is an attempt to improve the call stack part of the warning message by providing caller explicitly.
* minor edits in AM documentation [ci skip]Francesco Rodriguez2012-10-211-1/+1
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-08-041-0/+8
|\ | | | | | | | | | | Conflicts: activemodel/lib/active_model/secure_password.rb activerecord/lib/active_record/associations/collection_proxy.rb
| * add example to ActiveModel::MissingAttributeError [ci skip]Francesco Rodriguez2012-07-281-0/+8
| |
* | load active_support/deprecation in active_support/railsXavier Noria2012-08-021-1/+0
| |
* | load active_support/core_ext/class/attribute in active_support/railsXavier Noria2012-08-021-1/+0
|/
* Refactor attribute method matcher to use Hash#fetchCarlos Antonio da Silva2012-06-261-5/+3
|
* Cleanup attribute methods a bit, use map! when accepting *argsCarlos Antonio da Silva2012-06-261-17/+12
| | | | | | | | | Since we're dealing with a new array instance, it's safe to use map! and we avoid an extra array object. Also remove the symbolize_keys! from AttributeMethodMatcher, since it's an internal class that always receives symbol keys from the prefix/suffix methods implementations.
* add :nodoc: to internal implementations [ci skip]Francesco Rodriguez2012-06-221-1/+1
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-06-221-35/+92
|\
| * fixes a few mistakes in api docs [ci skip]Vijay Dev2012-06-221-1/+1
| |
| * add description to ActiveModel::MissingAttributeError [ci skip]Francesco Rodriguez2012-06-211-1/+2
| |
| * add example to ActiveModel::AttributeMethods#undefine_attribute_methods [ci ↵Francesco Rodriguez2012-06-211-0/+26
| | | | | | | | skip]
| * add docs to AM::AttributeMethods#define_attribute_method [ci skip]Francesco Rodriguez2012-06-211-0/+25
| |
| * fix ActiveModel::AttributeMethods#alias_attribute documentation [ci skip]Francesco Rodriguez2012-06-211-7/+20
| |
| * update ActiveModel::AttributeMethods documentation [ci skip]Francesco Rodriguez2012-06-211-27/+20
| |
| * add example to ActiveModel::Validations#validators [ci skip]Francesco Rodriguez2012-06-151-1/+0
| |
* | Merge pull request #6800 from mschneider/dynamic_finders_for_aliased_attributesRafael Mendonça França2012-06-221-1/+3
|\ \ | | | | | | Dynamic finders for aliased attributes
| * | made dynamic finders alias_attribute awareMaximilian Schneider2012-06-221-1/+3
| | | | | | | | | | | | | | | previously dynamic finders only worked in combination with the actual column name and not its alias defined with #alias_attribute
* | | add :nodoc: to AM::AttributeMethods#instance_method_already_implemented? [ci ↵Francesco Rodriguez2012-06-211-1/+1
| | | | | | | | | | | | skip]
* | | add :nodoc: to AM::AttributeMethods::AttributeMethodMatcher [ci skip]Francesco Rodriguez2012-06-211-1/+1
|/ /
* / Simplify AR configuration code.Jon Leighton2012-06-151-2/+1
|/ | | | | Get rid of ActiveModel::Configuration, make better use of ActiveSupport::Concern + class_attribute, etc.
* Merge pull request #4785 from ↵José Valim2012-05-251-4/+4
|\ | | | | | | | | ayamomiji/add-self-to-allow-method-name-using-ruby-keyword add `self.` to allow method name using ruby keyword
| * fix `alias_attribute` will raise a syntax error if make an alias on aayaya2012-05-141-4/+4
| | | | | | | | column that named as a ruby keyword
* | Revert "Merge pull request #5702 from oscardelben/patch-4"Piotr Sarnacki2012-05-201-1/+3
| | | | | | | | | | | | | | This reverts commit cae1ca7d1be9c79c7ef012a1f62aef9d3bb815f8, reversing changes made to da97cf016a8ffd1f54f804cd881f393e5d6efc18. These changes break the build, it needs more investigation.
* | Call undefine_attribute_methods only when defining new attributesOscar Del Ben2012-05-181-3/+1
| |
* | allow define_attribute_methods to pass multiple valuesFrancesco Rodriguez2012-05-141-7/+7
| |
* | Merge pull request #5729 from oscardelben/use_tapJosé Valim2012-05-131-5/+1
|\ \ | | | | | | Use the more idiomatic tap method
| * | Use the more idiomatic tap methodOscar Del Ben2012-04-041-5/+1
| |/
* | simplify the alias_attribute example [ci skip]Vijay Dev2012-05-081-20/+1
| |
* | added docs to alias_attribute methodFrancesco Rodriguez2012-05-071-0/+31
|/
* ruby 2.0 makes protected methods return false for respond_to, so pass true ↵Aaron Patterson2012-02-211-1/+1
| | | | as the second param
* remove unused capturesAaron Patterson2012-01-191-2/+2
|
* Fix stack level too deep when model does not have attributes method.Piotr Sarnacki2012-01-151-1/+1
| | | | | | | | | | | Without that patch when using ActiveModel::AttributeMethods in a class that does not respond to `attributes` method, stack level too deep error will be raised on non existing method. While documentation is clear that you need to define `attributes` method in order to use AttributeMethods module, `stack level too deep` is rather obscure and hard to debug, therefore we should try to not break `method_missing` if someone forgets about defining `attributes`.
* Support configuration on ActiveRecord::Model.Jon Leighton2011-12-281-1/+2
| | | | | | | | | | | | | | | The problem: We need to be able to specify configuration in a way that can be inherited to models that include ActiveRecord::Model. So it is no longer sufficient to put 'top level' config on ActiveRecord::Base, but we do want configuration specified on ActiveRecord::Base and descendants to continue to work. So we need something like class_attribute that can be defined on a module but that is inherited when ActiveRecord::Model is included. The solution: added ActiveModel::Configuration module which provides a config_attribute macro. It's a bit specific hence I am not putting this in Active Support or making it a 'public API' at present.
* remove deprecated define_attr_method from ActiveModel::AttributeMethodsSergey Nartimov2011-12-241-41/+0
|
* Deprecated `define_attr_method` in `ActiveModel::AttributeMethods`Jon Leighton2011-11-291-37/+20
| | | | | This only existed to support methods like `set_table_name` in Active Record, which are themselves being deprecated.
* Speed up attribute invocation by checking if both name and calls are compilable.José Valim2011-11-141-27/+32
|
* Class name specified in example is Person, not AttributePerson.Uģis Ozols2011-09-291-3/+3
|
* Generate attribute method unless it's already in the module.Jon Leighton2011-09-141-1/+1
| | | | | | | There's no harm in generating a method name that's already defined on the host class, since we're generating the attribute methods in a module that gets included. In fact, this is desirable as it allows the host class to call super.
* Add an attribute_missing method to ActiveModel::AttributeMethods.Jon Leighton2011-09-131-8/+11
| | | | This can be overloaded by implementors if necessary.
* Avoid double super call in some cases.Jon Leighton2011-09-131-5/+4
| | | | | If super was false earlier, it is still going to be false, so we don't need to call it again at the end of the method.
* Let Ruby deal with method visibility.Jon Leighton2011-09-131-13/+11
| | | | | | 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.
* Add deprecation for doing `attribute_method_suffix ''`Jon Leighton2011-09-131-0/+11
|
* refactoringJon Leighton2011-09-131-19/+11
|