Commit Graph

8 Commits

Author SHA1 Message Date
Larry Lv 1efe30ebce set up config_accessor with a default value by block
* ActiveSupport::Configurable should allow config_accessor to take
  default value by block, just like cattr_accessor.

    class User
      include ActiveSupport::Configurable
      config_accessor :hair_colors do
        [:brown, :black, :blonde, :red]
      end
    end

    User.hair_colors # => [:brown, :black, :blonde, :red]

* remove trailing whitespaces in configurable.rb and its test file.

* Update ActiveSupport CHANGELOG.
2012-09-17 09:14:21 +08:00
Francesco Rodriguez 5e1d40f773 add instance_accessor option to ActiveSupport::Configurable#config_accessor
Changes:

* Add `instance_accessor` option to opt out of the instance writer and
  instance reader methods.
* Raises a NameError if the name of the attribute is not valid.
* Update documentation and tests.
* Add CHANGELOG entry in activesupport.
2012-06-05 10:50:48 -05:00
José Valim d677097eb6 Fix configurable cristalization and tests. 2011-06-29 13:57:59 -03:00
José Valim 894bdbd53d Move variables to underscore format, update protected instance variables list. 2011-05-06 14:57:25 +02:00
Oriol Gual and Josep M. Bach f42562f97b Make ActiveSupport::Configurable work with modules
[#6486 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-28 13:30:32 -02:00
José Valim 6067d16200 Call it compile_methods! and do the same on AM. 2010-09-27 20:43:56 +02:00
thedarkone 918dc27345 Compile ActionController::Base.config's methods to avoid method_missing overhead. 2010-09-27 17:45:58 +02:00
José Valim 4163ccec23 Clean up the config object in ActionPack. Create config_accessor which just delegates to the config object, reducing the number of deprecations and add specific tests. 2010-04-22 12:00:13 +02:00