diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-03-13 22:56:00 -0700 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-03-13 22:56:00 -0700 |
commit | cd9efb9eec6198f08b4fd5d754a33aa1b1669b37 (patch) | |
tree | cffc8cdbd3d9385461e387c09cc9557b74d24d04 /lib/active_relation | |
parent | 384008b04b48735a73dbba5a7d4a18e794c897ad (diff) | |
download | rails-cd9efb9eec6198f08b4fd5d754a33aa1b1669b37.tar.gz rails-cd9efb9eec6198f08b4fd5d754a33aa1b1669b37.tar.bz2 rails-cd9efb9eec6198f08b4fd5d754a33aa1b1669b37.zip |
annotated abstract methods on relation
Diffstat (limited to 'lib/active_relation')
-rw-r--r-- | lib/active_relation/relations/relation.rb | 17 | ||||
-rw-r--r-- | lib/active_relation/relations/writing.rb | 5 |
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/active_relation/relations/relation.rb b/lib/active_relation/relations/relation.rb index 9847cf2b7c..15782cde06 100644 --- a/lib/active_relation/relations/relation.rb +++ b/lib/active_relation/relations/relation.rb @@ -1,5 +1,7 @@ module ActiveRelation class Relation + abstract :attributes, :selects, :orders, :inserts, :groupings, :joins, :limit, :offset, :alias + def session Session.new end @@ -119,14 +121,17 @@ module ActiveRelation def call(connection = engine.connection) connection.select_all(to_sql) end - - def attribute_for_name(name) - attributes.detect { |a| a.alias_or_name.to_s == name.to_s } - end + + module AttributeAccessors + def attribute_for_name(name) + attributes.detect { |a| a.alias_or_name.to_s == name.to_s } + end - def attribute_for_attribute(attribute) - attributes.detect { |a| a =~ attribute } + def attribute_for_attribute(attribute) + attributes.detect { |a| a =~ attribute } + end end + include AttributeAccessors def bind(relation) self diff --git a/lib/active_relation/relations/writing.rb b/lib/active_relation/relations/writing.rb new file mode 100644 index 0000000000..3054e9b72f --- /dev/null +++ b/lib/active_relation/relations/writing.rb @@ -0,0 +1,5 @@ +module ActiveRelation + class Writing < Compound + abstract :call, :to_sql + end +end
\ No newline at end of file |