Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
##articles_controller.rb # PUT /admin/articles/1 # PUT /admin/articles/1.xml def update @article = Article.find(params[:id]) respond_to do |format| if @article.update_attributes(params[:article]) flash[:notice] = 'Article was successfully updated.' format.html { redirect_to admin_article_path(@article) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @article.errors, :status => :unprocessable_entity } end end end ##views/admin/articles/edit.html.erb <% title "Editing #{@article.title}" %> <%= error_messages_for :article %> <% form_for :article, :url => admin_article_path(@article) do |f| %> <%= render :partial => 'form', :locals => { :f => f, :bt_name => 'Update'} %> <% end %> <%= link_to 'Show', admin_article_path(@article) %> | <%= link_to 'Back', admin_articles_path %>
This paste will be private.
From the Design Piracy series on my blog: