[Jifty-commit] r3839 - jifty/trunk/lib/Jifty/Action
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Aug 10 05:42:43 EDT 2007
Author: clkao
Date: Fri Aug 10 05:42:40 2007
New Revision: 3839
Modified:
jifty/trunk/lib/Jifty/Action/Record.pm
Log:
In action argument creation from model, do not assume refers_to
always want a select based on id which we might not be referring to.
Allow user to override render_as for refers_to columns.
Modified: jifty/trunk/lib/Jifty/Action/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record.pm (original)
+++ jifty/trunk/lib/Jifty/Action/Record.pm Fri Aug 10 05:42:40 2007
@@ -196,7 +196,10 @@
elsif ( defined (my $refers_to = $column->refers_to) ) {
if ( UNIVERSAL::isa( $refers_to, 'Jifty::Record' ) ) {
+ $info->{render_as} = $render_as || 'Select';
+ }
+ if ( $info->{render_as} eq 'Select' ) {
my $collection = Jifty::Collection->new(
record_class => $refers_to,
current_user => $self->record->current_user
@@ -205,14 +208,13 @@
my $method = $refers_to->_brief_description();
+ # FIXME: we should get value_from with the actualy refered by key
$info->{valid_values} = [
{ display_from => $refers_to->can($method) ? $method : "id",
value_from => 'id',
collection => $collection
}
];
-
- $info->{render_as} = 'Select';
} else {
# No need to generate arguments for
# JDBI::Collections, as we can't do anything
More information about the Jifty-commit
mailing list