Aaron Patterson
00327721e4
ruby 2.0 makes protected methods return false for respond_to, so pass true as the second param
2012-02-21 10:32:23 -08:00
Uģis Ozols
14e2fe200a
Class name specified in example is Person, not AttributePerson.
2011-10-05 18:49:29 +05:30
Xavier Noria
9b423ac0b7
let this regexp be stricter
...
The purpose of this regexp is to detect strings that
are valid identifiers to be used as method names.
The anchor $ allows a trailing newline, and both ^
and $ may be bypassed because Ruby regexps are
multiline always. The anchors \A and \z are the
proper ones to ensure string boundaries.
2011-04-19 18:16:38 +02:00
José Valim
dca31b9224
Let's not dup because value may not always be duplicable.
2011-04-19 18:06:01 +02:00
José Valim
30472d4244
Avoid define_method if possible.
2011-04-19 17:58:06 +02:00
Santiago Pastorino
450f7cf01b
use class_eval with a string when it's possible
2011-03-22 20:11:36 -03:00
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
4532b39f5f
remove misleading comment
2011-03-17 10:31:12 -07: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
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
Santiago Pastorino
082326deb5
module_eval is not needed here
2011-02-03 20:47:02 -02:00
Santiago Pastorino
6f4d9989dd
method_defined?, define_method and send accepts a string as argument
2011-02-03 20:37:12 -02: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
Paul Yoder
d8919d3151
Deleted extra "a" in method comment
2011-01-27 09:27:35 -06:00
José Valim
6b099975fa
No need to symbolize these.
2010-12-27 09:30:36 +01:00
Aaron Patterson
207f266cca
define_attr_method must serialize nil correctly
2010-12-20 19:47:15 -08:00
Aditya Sanghi
04922bafda
grammar fix
2010-11-27 19:56:08 +05:30
Robert Pankowecki
88688cdd8e
Fix when database column name has some symbolic characters. [ #5818 state:resolved]
2010-11-14 17:24:31 +08:00
Jeremy Kemper
d79b1aa0ba
Fewer object allocations
2010-09-09 14:37:58 -07:00
Jeremy Kemper
cb67d16629
Cheaper attribute_method_matchers
2010-09-09 14:37:58 -07:00
Jeremy Kemper
82ea5db030
Fix require for class_attribute
2010-09-09 14:34:29 -07: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
Adam Meehan
9a43640ed1
typo in AM
2010-08-09 13:44:04 +10:00
Evgeniy Dolzhenko
ef404c771d
Fix a bunch of minor spelling mistakes
2010-06-15 12:04:22 +04:00
Rizwan Reza
97d6778c80
Minor changes to active_model/attribute_methods
2010-06-14 13:36:05 +04:30
Evgeniy Dolzhenko
ccf9577aee
Fix a bunch of minor spelling mistakes
2010-06-11 14:15:34 +04:00
Santiago Pastorino
b38639ab71
typo 'Provivdes' -> 'Provides'
2010-05-05 00:55:44 -03:00
Santiago Pastorino
13e00ce606
fix stack trace lines on class_eval
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-04-09 21:28:49 +02:00
wycats
197904341f
Merge branch 'master' into docrails
2010-03-26 15:10:24 -07:00
Aaron Patterson
b652aa8121
cleaning up a bunch of method already defined warnings [ #4209 state:resolved]
...
Signed-off-by: wycats <wycats@gmail.com >
2010-03-17 13:56:33 -07:00
Pratik Naik
e68bfaf1fe
Merge remote branch 'mainstream/master'
...
Conflicts:
activerecord/lib/active_record/base.rb
railties/lib/rails/configuration.rb
railties/lib/rails/log_subscriber.rb
2010-03-12 16:00:01 +00:00
José Valim
ae8070e21b
Add missing information about attributes method.
2010-02-28 11:43:13 +01:00
Jeremy Kemper
f7b0a857e9
Use Object#singleton_class instead of #metaclass. Prefer Ruby's choice.
2010-02-25 09:32:29 -08:00
Mikel Lindsaar
12681c2a71
Merge branch 'master' of git://github.com/rails/rails
...
Conflicts:
activemodel/README
activemodel/lib/active_model/errors.rb
activemodel/lib/active_model/serialization.rb
railties/guides/source/3_0_release_notes.textile
2010-02-02 14:04:23 +11:00
Mikel Lindsaar
a07d0f8786
Full update on ActiveModel documentation
2010-02-01 10:08:20 +11:00
Mikel Lindsaar
8834b2612b
Adding ActiveModel::AttributeMethods documentation
2010-01-17 12:42:53 +11:00
Jeremy Kemper
4f590b67b7
Ruby 1.9.2: explicit coercion check no longer needed; bug fixed upstream
2010-01-01 11:02:09 -08:00
Jeremy Kemper
63e435955e
Ruby 1.9.2: explicitly raise NoMethodError for explicit coercion attempts
2009-12-06 18:22:09 -08: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
Joshua Peek
6dc9ad80e6
Fix warnings in AMo
2009-09-05 19:10:21 -05:00
Joshua Peek
391f978acd
AMo overrides alias_attribute and manages aliasing all known attribute method matchers
2009-08-10 11:58:44 -05:00
Joshua Peek
d574cb31f0
Centralize attr method name concatenation in AttributeMethodMatch
2009-08-10 11:53:10 -05:00
Joshua Peek
f8d3c72c39
Extract generic attribute method generation to AMo
2009-08-04 23:36:05 -05:00