Commit Graph

813 Commits

Author SHA1 Message Date
Jon Leighton
93c1f11c0a Support configuration on ActiveRecord::Model.
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.
2011-12-28 18:27:41 +00:00
Vijay Dev
54e522a388 Merge branch 'master' of github.com:lifo/docrails 2011-12-25 19:33:33 +05:30
José Valim
b28ed2bd4f Merge pull request #4172 from nashby/refactor-tokenizer
don't call an extra method if options[:tokenizer] is not present
2011-12-24 12:48:45 -08:00
Vasiliy Ermolovich
fdbd6779fe don't call an extra method if options[:tokenizer] is not present 2011-12-24 23:40:09 +03:00
Sergey Nartimov
9813c62330 remove deprecated define_attr_method from ActiveModel::AttributeMethods 2011-12-24 21:26:15 +03:00
Vasiliy Ermolovich
ee2095e107 use Range#min and Range#max to reduce extra statement 2011-12-24 19:33:45 +03:00
Sergey Nartimov
5ca86ac8f9 deprecate String#encoding_aware? and remove its usage 2011-12-24 15:57:54 +03:00
Kristian Freeman
2315e96a17 Finished implementation of MIT license linking. 2011-12-23 13:03:21 -08:00
Bogdan Gusiev
150217f54f AM::MAS.attr_protected: rework usage example. 2011-12-23 10:05:39 +02:00
Bogdan Gusiev
46ec75661d Fixed AM::MasAsSec.attr_protected usage example.
Problems with current example:

* DOESN'T WORK 
** attr_protected :last_login, :as => :admin # doesn't make it accessible for admin
* Uses ActiveSupport Fixnum extension
2011-12-22 10:57:06 +02:00
Bogdan Gusiev
24a6609ea3 Fix AM::MassAssignementSecurity doc 2011-12-22 10:24:20 +02:00
Karunakar (Ruby)
ed1b4ea3f9 Changed the require path for logger 2011-12-21 19:42:44 +05:30
Karunakar (Ruby)
f7d3db71fc removed deprecated loggers 2011-12-21 19:30:45 +05:30
Jakub Kuźma
0fe311a7fc added :other_than => :!= option to numericality validator 2011-12-21 10:54:44 +01:00
Rahul P. Chaudhari
e883c06a4f Updated gemspec for ruby 1.9.3 2011-12-21 11:09:01 +05:30
José Valim
7ba28d434c Remove dead code from AMo. 2011-12-20 18:38:20 +01:00
David Heinemeier Hansson
632fa15fa4 rails/master is now 4.0.0.beta and will only support Ruby 1.9.3+ 2011-12-20 09:30:37 -06:00
José Valim
23f6cabff1 Remove i18n dependencies from AP and AMo since they are in AS. 2011-12-20 08:51:56 +01:00
David Heinemeier Hansson
9d6e52b55e Party like its R-C-UNO! 2011-12-19 18:34:57 -06:00
Arun Agrawal
4fac64b1cc Fixed test "ArgumentError: wrong number of arguments(1 for 0)" 2011-12-17 16:49:01 +05:30
Antonio Roberto
66e747b461 Fixed bug when error message is an empty string. 2011-12-16 17:17:14 -02:00
José Valim
7280787a53 Improve cache on route_key lookup. 2011-12-08 19:53:16 +01:00
José Valim
f0f0e59c10 Ensure length validator also works on 1.8.7. 2011-12-06 14:13:44 +01:00
José Valim
81fec5dfc4 Merge pull request #3872 from marcandre/i18n_key
ActiveModel::Name#i18n_key: Fix doc and add tests
2011-12-06 00:41:43 -08:00
José Valim
1ee832b2d8 Merge pull request #3873 from iangreenleaf/no_default_tokenizer
Don't tokenize string when counting characters
2011-12-06 00:41:05 -08:00
Marc-Andre Lafortune
d834755dad ActiveModel::Name#i18n_key: Fix doc and add tests 2011-12-05 22:02:53 -05:00
José Valim
d4964b3386 Namespaced attribute lookup now works as 'model/association.attribute'. 2011-12-05 15:39:41 +01:00
José Valim
2985151000 Merge pull request #3859 from kuroda/human_attribute_name
Fix human_attribute_name to handle names with dots
2011-12-05 06:09:33 -08:00
Tsutomu Kuroda
dff19f7be2 Fix human_attribute_name to handle names with dots
Nested I18n namespace lookup under activerecord.models is deprecated now (c19bd4f).
But when a model uses accepts_nested_attributes_for, its Errors object can have
an attribute name with "addresses.street" style. In this case, the dots should be
substituted with slashes so that we can provide the translation under the
"activemodel.attributes.person.addresses/street" key.
2011-12-05 22:57:47 +09:00
Ian Young
5ff71ac9f8 Don't tokenize string when counting characters 2011-12-04 23:20:54 -08:00
Alexey Vakhov
814a4c3160 Fix argument error message for length validation 2011-12-01 09:12:16 +04:00
Vijay Dev
88daf08258 Merge branch 'master' of github.com:lifo/docrails 2011-11-30 23:32:01 +05:30
José Valim
5b2eb64ceb Revert "Implement ArraySerializer and move old serialization API to a new namespace."
This reverts commit 8896b4fdc8a543157cdf4dfc378607ebf6c10ab0.

Conflicts:

	activemodel/lib/active_model.rb
	activemodel/lib/active_model/serializable.rb
	activemodel/lib/active_model/serializer.rb
	activemodel/test/cases/serializer_test.rb
2011-11-30 18:48:17 +01:00
lest
6ce924fa9f fix method redefined warning in activemodel 2011-11-30 18:57:17 +03:00
José Valim
38ab982cff Log 'Filter chain halted as CALLBACKNAME rendered or redirected' every time a before callback halts. 2011-11-30 09:53:09 +01: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
Alexey Vakhov
448df2d100 Cosmetic fixes in AM validatations docs 2011-11-27 10:23:40 +04:00
Arun Agrawal
9817a8b7d6 Warning removed unused variable 2011-11-26 19:30:11 +05:30
Vijay Dev
1d89540686 Merge branch 'master' of github.com:lifo/docrails 2011-11-26 19:14:39 +05:30
José Valim
0a4035b12a Revert the serializers API as other alternatives are now also under discussion 2011-11-25 19:29:39 +00:00
José Valim
fcacc6986a Merge branch 'serializers'
This implements the ActiveModel::Serializer object. Includes code, tests, generators and guides.

From José and Yehuda with love.

Conflicts:
	railties/CHANGELOG.md
2011-11-25 09:59:35 +00:00
José Valim
696d01f7f4 Add docs to serializers. Update CHANGELOGs. 2011-11-25 09:49:54 +00:00
Jakub Kuźma
dc39af0a9a make ActiveModel::Name fail gracefully with anonymous classes 2011-11-24 15:50:21 +01:00
José Valim
28bcda4098 Rename UserSerializer to DefaultUserSerializer in tests. 2011-11-23 23:53:20 +00:00
José Valim
7fcc8c0a1f Rely solely on active_model_serializer and remove the fancy constant lookup. 2011-11-23 23:45:27 +00:00
José Valim
8896b4fdc8 Implement ArraySerializer and move old serialization API to a new namespace.
The following constants were renamed:

  ActiveModel::Serialization     => ActiveModel::Serializable
  ActiveModel::Serializers::JSON => ActiveModel::Serializable::JSON
  ActiveModel::Serializers::Xml  => ActiveModel::Serializable::XML

The main motivation for such a change is that `ActiveModel::Serializers::JSON`
was not actually a serializer, but a module that when included allows the target to be serializable to JSON.

With such changes, we were able to clean up the namespace to add true serializers as the ArraySerializer.
2011-11-23 23:18:15 +00:00
José Valim
e62de52aa3 Merge branch 'master' into serializers 2011-11-23 20:43:06 +00:00
José Valim
fd86a1b6b0 Rely on a public contract between railties instead of accessing railtie methods directly. 2011-11-23 19:06:45 +00:00
Alexey Vakhov
efbb73562d Small docs fix in Active Model callbacks module 2011-11-19 12:19:59 +06:00
Prem Sichanugrist
0e2156d334 Update variable's name in the test case to reflect the class we're testing 2011-11-18 11:51:05 -05:00