Skip to content

Instantly share code, notes, and snippets.

@multiplier
Forked from dhh/gist:1975644
Created June 20, 2012 15:26
Show Gist options
  • Select an option

  • Save multiplier/2960468 to your computer and use it in GitHub Desktop.

Select an option

Save multiplier/2960468 to your computer and use it in GitHub Desktop.

Revisions

  1. David Heinemeier Hansson created this gist Mar 5, 2012.
    14 changes: 14 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    class PostsController < ActionController::Base
    def create
    Post.create(post_params)
    end

    def update
    Post.find(params[:id]).update_attributes!(post_params)
    end

    private
    def post_params
    params[:post].slice(:title, :content)
    end
    end