[Jifty-commit] r686 - in jifty/trunk: lib/Jifty/Action
lib/Jifty/Action/Record
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Mar 13 19:56:42 EST 2006
Author: alexmv
Date: Mon Mar 13 19:56:41 2006
New Revision: 686
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Action/Record.pm
jifty/trunk/lib/Jifty/Action/Record/Create.pm
Log:
r8508 at zoq-fot-pik: chmrr | 2006-03-13 19:56:33 -0500
* Jifty::Action::Record::Create needs to be able to set immutable columns
Modified: jifty/trunk/lib/Jifty/Action/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record.pm (original)
+++ jifty/trunk/lib/Jifty/Action/Record.pm Mon Mar 13 19:56:41 2006
@@ -101,7 +101,7 @@
my $field_info = {};
- my @fields = $self->record->writable_attributes;
+ my @fields = $self->possible_fields;
# we use a while here because we may be modifying the fields on the fly.
while ( my $field = shift @fields ) {
@@ -225,6 +225,17 @@
return $field_info;
}
+=head2 possible_fields
+
+Returns the list of fields on the object that the action can update.
+This defaults to only the writable fields of the object.
+
+=cut
+
+sub possible_fields {
+ my $self = shift;
+ return $self->record->writable_attributes;
+}
=head2 _canonicalize_date DATE
Modified: jifty/trunk/lib/Jifty/Action/Record/Create.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record/Create.pm (original)
+++ jifty/trunk/lib/Jifty/Action/Record/Create.pm Mon Mar 13 19:56:41 2006
@@ -58,6 +58,7 @@
my %values;
$values{$_} = $self->argument_value($_) for grep { defined $self->argument_value($_) } $self->argument_names;
+ warn "Values are ".YAML::Dump([$self->arguments]);
my ($id) = $record->create(%values);
@@ -76,6 +77,19 @@
return 1;
}
+=head2 possible_fields
+
+Returns all of the columns on the record class. This is because,
+unlike L<Jifty::Action::Record::Update>, columns which are marked as
+'immutable' should still be able to be set at creation time.
+
+=cut
+
+sub possible_fields {
+ my $self = shift;
+ return map {$_->name} $self->record->columns;
+}
+
=head2 report_success
Sets the L<Jifty::Result/message> to default success message,
More information about the Jifty-commit
mailing list