mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
annotated abstract methods on relation
This commit is contained in:
parent
384008b04b
commit
cd9efb9eec
2 changed files with 16 additions and 6 deletions
|
@ -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
|
||||
|
|
5
lib/active_relation/relations/writing.rb
Normal file
5
lib/active_relation/relations/writing.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
module ActiveRelation
|
||||
class Writing < Compound
|
||||
abstract :call, :to_sql
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue