## lib/Jizzy/Controller/Categories.pm sub edit { my $self = shift; # Fetch the category id from the parameters my $id = $self->param('id'); # Get information from the database about the category my $result = $self->db->resultset('Category')->find($id); $self->param('parent_id', $result->parent_id) unless $self->param('parent_id'); # Add information in the stash for the template (e.g. edit.html.ep) $self->stash(id => $result->id); # Render the template $self->render; } ## templates/categories/edit.html.ep % layout 'admin' % title => 'Jizzy.eu: Edycja Kategorii';

Category Edit [<%= stash 'id' %>]

%= form_for 'update_category' => (method => 'POST') => begin %= include '/categories/_form' % end ### templates/categories/_form.html.ep % my $options = category_select
<%= label_for parent_id => 'Parent:' %> %= select_field parent_id => $options, class => 'input'