[jifty-devel] jifty::dbi::schema and reference names
trs at bestpractical.com
Mon Feb 21 13:50:35 EST 2011
On 21 Feb 2011 12:56, Matt Zagrabelny wrote:
> #pseudocode examples...
> $staged_infrastructure->staged_interfaces #works
> $staged_interface->staged_infrastructure #works
> $staged_interface->staged_interface_links #works
> $staged_interface_link->staged_interface # FAILS
The methods that work are either column names, or column names with the
_id stripped off the end (Jifty magic). The method that fails is never
defined as a column for a StagedInterfaceLink.
> Obviously there is an inability to determine what reference to use, as
> both references point back to the 'StagedInterface' model/table. How
> do I give the references a handle (name) to go by?
> I would need something like:
> but I don't know how to make the names work.
The correct methods are the respective column names without the _id:
> column id =>
> type is 'INTEGER';
As a side note, you don't need to declare the id column for every model
since Jifty automatically adds it. You can also drop your "type is
'INTEGER'" declarations since integers are the default. Similarly, the
references keyword doesn't need an explicit "by 'id'".
More information about the jifty-devel