####_form.html.ep #Under code I don't know to move to Controller % my $categories = Mojo::Collection->new(['*' => 0]); % my $cats = $self->db->resultset('Category'); % while (my $cat = $cats->next) { % my @attr; % push @attr, selected => 'selected' if $cat->id eq $category->id; % push @{$categories}, [$cat->name, $cat->id, @attr]; % } #Under code must automatically select 'saved item at created or last change' %= select_field parent_id => $categories => (class=>'input') ####edit.html.ep % layout 'admin', title => 'Jizzy.eu: Edycja Kategorii'; % my $category = $self->db->resultset('Category')->find($self->stash('id'));

Category Edit [<%= $category->id %>]

%= form_for 'update_category' => (method => 'POST') => begin %= include '/categories/_form', category => $category % end