| Home | Trees | Indices | Help |
|---|
|
|
object --+
|
Association --+
|
Has
Builds the association scope for a has association. This
is the superclass for HasOne and HasMany
associations. The only difference between a has one and has many
relation, is that .first() is called on the has one
association's scope but not on the has many association's scope. See the
Association class for more details on how associations
work.
| Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|||
| Properties | |
| foreign_key | |
|
Inherited from |
|
| Method Details |
|
|
|
Returns a scope on the source class containing this association Builds conditions on top of the base_scope generated from any finder options set with the association:
has_many('widgets', klass=Widget, foreign_key='widget_id')
has_many('comments', as_='parent')
In addition to any finder options included with the association options the following will be added:
where('widget_id = %s ' % target['id'])
Or for the polymorphic :comments association:
where('parent_id = %s AND parent_type = %s' % (target['id'],
target.class))
|
| Property Details |
foreign_key
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Thu Jun 30 17:41:50 2011 | http://epydoc.sourceforge.net |