Skip to content

Commit

Permalink
just do nothing in the form_for example
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 15, 2015
1 parent b6100f9 commit a286cd7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

6.03 2015-03-15
6.03 2015-03-16
- Added support for overriding the HTTP request method with the _method query
parameter.
- Added suggested_method method to Mojolicious::Routes::Route.
Expand Down
18 changes: 8 additions & 10 deletions lib/Mojolicious/Guides/Rendering.pod
Expand Up @@ -846,16 +846,14 @@ parameter.

get '/' => 'form';

# PUT /surprise
# POST /surprise?_method=PUT
put '/surprise' => sub {
my $c = shift;

my $url = $c->param('url');
my $title = $c->ua->get($url)->res->dom->at('title')->text;
# PUT /nothing
# POST /nothing?_method=PUT
put '/nothing' => sub {
my $c = shift;
my $value = $c->param('whatever');

# Prevent double submit with redirect
$c->flash(confirmation => qq{The title of "$url" was "$title".});
$c->flash(confirmation => "We did nothing with your value ($value).");
$c->redirect_to('form');
};

Expand All @@ -869,8 +867,8 @@ parameter.
% if (my $confirmation = flash 'confirmation') {
<p><%= $confirmation %></p>
% }
%= form_for surprise => begin
%= text_field 'url', value => 'http://mojolicio.us'
%= form_for nothing => begin
%= text_field 'whatever', value => 'I ♥ Mojolicious!'
%= submit_button
% end
</body>
Expand Down

0 comments on commit a286cd7

Please sign in to comment.