From 2ebea1c02d10e0fea26bd98d297a8f4d41dc1aff Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Sun, 31 Jan 2010 16:27:24 +1100 Subject: deOMGifying Railties, Active Support, and Action Pack --- railties/guides/source/rails_application_templates.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/rails_application_templates.textile b/railties/guides/source/rails_application_templates.textile index fc178fa44b..579b1a5538 100644 --- a/railties/guides/source/rails_application_templates.textile +++ b/railties/guides/source/rails_application_templates.textile @@ -88,7 +88,7 @@ Please note that you need to +git :init+ before you can install a plugin as a su Or use plain old SVN : -plugin 'wtfsvn', :svn => 'svn://crap.com/wtf/trunk' +plugin 'usingsvn', :svn => 'svn://example.com/usingsvn/trunk' h4. vendor/lib/file/initializer(filename, data = nil, &block) -- cgit v1.2.3 From 27fa38cc3e162b2f8c4bb2d50130fbc17bad6039 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 2 Feb 2010 00:37:15 +0100 Subject: AS guide: documents Class#class_attribute --- .../source/active_support_core_extensions.textile | 37 +++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 562bc76135..fb4c42f118 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -496,7 +496,42 @@ The class method +delegate+ h3. Extensions to +Class+ -h4. Class Attribute Accessors +h4. Class Attributes + +The method +Class#class_attribute+ declares one or more inheritable class attributes that can be overriden at any level down the hierarchy: + + +class A + class_attribute :x +end + +class B < A; end + +class C < B; end + +A.x = :a +B.x # => :a +C.x # => :a + +B.x = :b +A.x # => :a +C.x # => :b + +C.x = :c +A.x # => :a +B.x # => :b + + +For example that's the way the +allow_forgery_protection+ flag is implemented for controllers: + + +class_attribute :allow_forgery_protection +self.allow_forgery_protection = true + + +For convenience +class_attribute+ defines also a predicate, so that declaration also generates +allow_forgery_protection?+. Such predicate returns the double boolean negation of the value. + +NOTE: Defined in +active_support/core_ext/class/attribute.rb+ The macros +cattr_reader+, +cattr_writer+, and +cattr_accessor+ are analogous to their +attr_*+ counterparts but for classes. They initialize a class variable to +nil+ unless it already exists, and generate the corresponding class methods to access it: -- cgit v1.2.3 From 9b5dae7af5757769c1e69d74a59ff036adc1f30f Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 2 Feb 2010 01:04:35 +0100 Subject: update html_safe calls in guides generation --- railties/guides/source/layout.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/layout.html.erb b/railties/guides/source/layout.html.erb index 7dfcf4a507..5f324ece60 100644 --- a/railties/guides/source/layout.html.erb +++ b/railties/guides/source/layout.html.erb @@ -87,7 +87,7 @@
- <%= yield.html_safe! %> + <%= yield.html_safe %>
-- cgit v1.2.3