mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Removed broken attempt to DRY module ClassMethod #970
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1069 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
c788bcb416
commit
7c8d2f28e1
9 changed files with 41 additions and 1 deletions
|
@ -1,5 +1,10 @@
|
||||||
module ActionController
|
module ActionController
|
||||||
module Scaffolding # :nodoc:
|
module Scaffolding # :nodoc:
|
||||||
|
def self.append_features(base)
|
||||||
|
super
|
||||||
|
base.extend(ClassMethods)
|
||||||
|
end
|
||||||
|
|
||||||
# Scaffolding is a way to quickly put an Active Record class online by providing a series of standardized actions
|
# Scaffolding is a way to quickly put an Active Record class online by providing a series of standardized actions
|
||||||
# for listing, showing, creating, updating, and destroying objects of the class. These standardized actions come
|
# for listing, showing, creating, updating, and destroying objects of the class. These standardized actions come
|
||||||
# with both controller logic and default templates that through introspection already know which fields to display
|
# with both controller logic and default templates that through introspection already know which fields to display
|
||||||
|
|
|
@ -27,6 +27,11 @@ module ActionController #:nodoc:
|
||||||
# :redirect_to => :category_url
|
# :redirect_to => :category_url
|
||||||
#
|
#
|
||||||
module Verification
|
module Verification
|
||||||
|
def self.append_features(base) #:nodoc:
|
||||||
|
super
|
||||||
|
base.extend(ClassMethods)
|
||||||
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
# Verify the given actions so that if certain prerequisites are not met,
|
# Verify the given actions so that if certain prerequisites are not met,
|
||||||
# the user is redirected to a different action. The +options+ parameter
|
# the user is redirected to a different action. The +options+ parameter
|
||||||
|
|
|
@ -120,7 +120,7 @@ if Object.const_defined?("ActiveRecord") || File.exist?(path_to_ar)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue SqliteError => e
|
rescue Object => e
|
||||||
puts "Skipping active record based tests"
|
puts "Skipping active record based tests"
|
||||||
puts e.message
|
puts e.message
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,11 @@ module ActionWebService # :nodoc:
|
||||||
class ContainerError < ActionWebServiceError # :nodoc:
|
class ContainerError < ActionWebServiceError # :nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.append_features(base) # :nodoc:
|
||||||
|
super
|
||||||
|
base.extend(ClassMethods)
|
||||||
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
# Attaches ActionWebService API +definition+ to the calling class.
|
# Attaches ActionWebService API +definition+ to the calling class.
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
module ActiveRecord
|
module ActiveRecord
|
||||||
module Acts #:nodoc:
|
module Acts #:nodoc:
|
||||||
module List #:nodoc:
|
module List #:nodoc:
|
||||||
|
def self.append_features(base)
|
||||||
|
super
|
||||||
|
base.extend(ClassMethods)
|
||||||
|
end
|
||||||
|
|
||||||
# This act provides the capabilities for sorting and reordering a number of objects in list.
|
# This act provides the capabilities for sorting and reordering a number of objects in list.
|
||||||
# The class that has this specified needs to have a "position" column defined as an integer on
|
# The class that has this specified needs to have a "position" column defined as an integer on
|
||||||
# the mapped database table.
|
# the mapped database table.
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
module ActiveRecord
|
module ActiveRecord
|
||||||
module Acts #:nodoc:
|
module Acts #:nodoc:
|
||||||
module Tree #:nodoc:
|
module Tree #:nodoc:
|
||||||
|
def self.append_features(base)
|
||||||
|
super
|
||||||
|
base.extend(ClassMethods)
|
||||||
|
end
|
||||||
|
|
||||||
# Specify this act if you want to model a tree structure by providing a parent association and an children
|
# Specify this act if you want to model a tree structure by providing a parent association and an children
|
||||||
# association. This act assumes that requires that you have a foreign key column, which by default is called parent_id.
|
# association. This act assumes that requires that you have a foreign key column, which by default is called parent_id.
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
module ActiveRecord
|
module ActiveRecord
|
||||||
module Aggregations # :nodoc:
|
module Aggregations # :nodoc:
|
||||||
|
def self.append_features(base)
|
||||||
|
super
|
||||||
|
base.extend(ClassMethods)
|
||||||
|
end
|
||||||
|
|
||||||
# Active Record implements aggregation through a macro-like class method called +composed_of+ for representing attributes
|
# Active Record implements aggregation through a macro-like class method called +composed_of+ for representing attributes
|
||||||
# as value objects. It expresses relationships like "Account [is] composed of Money [among other things]" or "Person [is]
|
# as value objects. It expresses relationships like "Account [is] composed of Money [among other things]" or "Person [is]
|
||||||
# composed of [an] address". Each call to the macro adds a description on how the value objects are created from the
|
# composed of [an] address". Each call to the macro adds a description on how the value objects are created from the
|
||||||
|
|
|
@ -8,6 +8,11 @@ require 'active_record/deprecated_associations'
|
||||||
|
|
||||||
module ActiveRecord
|
module ActiveRecord
|
||||||
module Associations # :nodoc:
|
module Associations # :nodoc:
|
||||||
|
def self.append_features(base)
|
||||||
|
super
|
||||||
|
base.extend(ClassMethods)
|
||||||
|
end
|
||||||
|
|
||||||
# Clears out the association cache
|
# Clears out the association cache
|
||||||
def clear_association_cache #:nodoc:
|
def clear_association_cache #:nodoc:
|
||||||
self.class.reflect_on_all_associations.to_a.each do |assoc|
|
self.class.reflect_on_all_associations.to_a.each do |assoc|
|
||||||
|
|
|
@ -9,6 +9,11 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.append_features(base)
|
||||||
|
super
|
||||||
|
base.extend(ClassMethods)
|
||||||
|
end
|
||||||
|
|
||||||
class AbstractWrapper #:nodoc:
|
class AbstractWrapper #:nodoc:
|
||||||
def self.wrap(attribute, record_binding) #:nodoc:
|
def self.wrap(attribute, record_binding) #:nodoc:
|
||||||
%w( before_save after_save after_initialize ).each do |callback|
|
%w( before_save after_save after_initialize ).each do |callback|
|
||||||
|
|
Loading…
Reference in a new issue