Skip to content

Commit

Permalink
annotate class_eval method for active resource schema attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaydev committed Jun 5, 2011
1 parent c2c8ef5 commit e1b202f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions activeresource/lib/active_resource/schema.rb
Expand Up @@ -20,8 +20,8 @@ class Schema # :nodoc:
# end # end
# #
# The schema stores the name and type of each attribute. That is then # The schema stores the name and type of each attribute. That is then
# read out by the schema method to populate the actual # read out by the schema method to populate the schema of the actual
# Resource's schema # resource.
def initialize def initialize
@attrs = {} @attrs = {}
end end
Expand All @@ -40,6 +40,12 @@ def attribute(name, type, options = {})
# The following are the attribute types supported by Active Resource # The following are the attribute types supported by Active Resource
# migrations. # migrations.
KNOWN_ATTRIBUTE_TYPES.each do |attr_type| KNOWN_ATTRIBUTE_TYPES.each do |attr_type|
# def string(*args)
# options = args.extract_options!
# attr_names = args
#
# attr_names.each { |name| attribute(name, 'string', options) }
# end
class_eval <<-EOV, __FILE__, __LINE__ + 1 class_eval <<-EOV, __FILE__, __LINE__ + 1
def #{attr_type.to_s}(*args) def #{attr_type.to_s}(*args)
options = args.extract_options! options = args.extract_options!
Expand Down

0 comments on commit e1b202f

Please sign in to comment.