1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

29 commits

Author SHA1 Message Date
Vipul A M
29dcf096b0 Small typos here and there. 2013-03-15 11:55:03 +05:30
Maximilian Schneider
f984b8152f made dynamic finders alias_attribute aware
previously dynamic finders only worked in combination with the actual
column name and not its alias defined with #alias_attribute
2012-06-22 16:44:01 +02:00
José Valim
56417b4092 Merge pull request #4785 from ayamomiji/add-self-to-allow-method-name-using-ruby-keyword
add `self.` to allow method name using ruby keyword
2012-05-25 00:29:07 -07:00
Francesco Rodriguez
05234b358f allow define_attribute_methods to pass multiple values 2012-05-14 11:35:15 -05:00
ayaya
c140a27fc5 fix alias_attribute will raise a syntax error if make an alias on a
column that named as a ruby keyword
2012-05-14 00:57:29 +08:00
Aaron Patterson
6289f455ae test against ruby features in order to fix tests on Ruby 2.0 2012-03-26 11:32:21 -07:00
Carlos Antonio da Silva
e5df4f9255 Fix test class name that should read Without 2012-01-16 00:00:57 +01:00
Piotr Sarnacki
b164e81c11 Fix stack level too deep when model does not have attributes method.
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`.
2012-01-15 15:54:59 +01:00
Sergey Nartimov
9813c62330 remove deprecated define_attr_method from ActiveModel::AttributeMethods 2011-12-24 21:26:15 +03:00
Jon Leighton
8df787d428 Deprecated define_attr_method in ActiveModel::AttributeMethods
This only existed to support methods like `set_table_name` in Active
Record, which are themselves being deprecated.
2011-11-29 20:13:37 +00:00
Jon Leighton
778c82bea6 Generate attribute method unless it's already in the module.
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.
2011-09-14 00:00:37 +01:00
Jon Leighton
c89e1c7bde Add an attribute_missing method to ActiveModel::AttributeMethods.
This can be overloaded by implementors if necessary.
2011-09-13 00:02:33 +01:00
Jon Leighton
ac687ed651 Let Ruby deal with method visibility.
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.
2011-09-13 00:01:58 +01:00
Jon Leighton
99bd6b53da Add deprecation for doing attribute_method_suffix '' 2011-09-13 00:01:57 +01:00
Jon Leighton
8b8b7143ef Use an empty AttributeMethodMatcher by default.
This means that attribute methods which don't exist will get generated
when define_attribute_methods is called, so we don't have to use hacks
like `attribute_method_suffix ''`.
2011-09-13 00:01:57 +01:00
ganesh
7c3094626d removed duplicate code 2011-06-11 21:49:12 +05:30
Santiago Pastorino
da6c7bd4b4 Do not in place modify what table_name returns 2011-03-22 19:36:16 -03:00
Santiago Pastorino
445241d713 define_attr_method should be able to define methods that returns nil 2011-03-17 23:17:20 -03:00
Aaron Patterson
00f0879367 dup strings on return so that in place modifications do not break anything. I am looking at you "compute_table_name" 2011-03-17 10:26:11 -07:00
Santiago Pastorino
c834a751d2 define_attr_method correctly defines methods with invalid identifiers 2011-03-16 21:20:44 -03:00
Santiago Pastorino
fda45f4fc4 Add a define_attr_method test 2011-03-16 21:08:02 -03:00
Santiago Pastorino
5232077517 Add test for define_attr_method using as name an invalid identifier 2011-03-16 21:01:49 -03:00
Santiago Pastorino
cb44e99de4 Add test for define_attribute_method using as name an invalid identifier 2011-03-16 21:01:04 -03:00
Alexander Uvarov
24faddd60c Move ActiveModel::AttributeMethods#attribute_methods_generated? to ActiveRecord, so it's flexible now
[#6428 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2011-03-01 20:22:45 +01:00
Caleb Land
bca070ef2d allow spaces and other characters in attribute names [#4725 state:resolved]
* define the dynamically defined methods with
  'define_method' instead of def
* wrap some string injected method names in quotes

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-03 19:05:17 -02: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
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
Sam Pohlenz
4df96338ed Fixed behavior of attribute_methods_generated? [#3220 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-10-07 09:07:39 -05:00
Sam Pohlenz
f8e91bda9c Don't share attribute matchers between classes [#3216 state:resolved]
Allows separate models that include ActiveModel::AttributeMethods to
use different sets of attribute matchers.

Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-10-07 09:07:39 -05:00