Something's wrong with the PUT action here, the form gets processed but the updated field is not being saved.
I've did what Sinatra users are doing, by adding in "_method" for Sinatra to recognise that's its a HTTP PUT action. Could anyone spot any mistake here?
# edit
get '/entries/*/:id/edit' do
@entry = Entries.get(params[:id])
@title = "edit"
erb :edit, :layout => :edit_layout
end
# update
put '/entries/:id' do
@entry = Entries.get(params[:id])
if @entry.save
redirect "/entries/id=#{@entry.id}"
else
redirect "/enewsletters"
end
end
<!-- Edit form -->
<form action="/enewsletters/edit/<%= @entry.id %>" method="post">
<input name="_method" value="put" type="hidden"/>
<p>
<label>Content</label><br/>
<input type="text" name="entry[title]" value="<%= @enew.title %>">
</p>
<p>
<input type="submit" name="commit" value="update">
</p>
</form>