Skip to content

Instantly share code, notes, and snippets.

@smd686s
Last active October 27, 2016 02:16

Revisions

  1. smd686s revised this gist Aug 23, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions app.rb
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    require 'rack/test'
    require 'action_controller/metal/strong_parameters'

    # https://github.com/rails/rails/blob/master/actionpack/test/controller/parameters/parameters_require_test.rb

    module Application
    class API < Grape::API

  2. smd686s revised this gist Aug 23, 2013. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion Gemfile
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    gem "actionpack", "~> 4.0.0"
    gem "actionpack", "~> 4.0.0"
    2 changes: 1 addition & 1 deletion app.rb
    Original file line number Diff line number Diff line change
    @@ -15,4 +15,4 @@ def item_params
    Item.new item_params
    end
    end
    end
    end
  3. smd686s revised this gist Aug 23, 2013. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions app.rb
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,18 @@
    require 'rack/test'
    require 'action_controller/metal/strong_parameters'

    module Application
    class API < Grape::API

    helpers do
    def item_params
    ActionController::Parameters.new(params).require(:item).permit(:attribute)
    end
    end

    desc "Create an item."
    post :items do
    Item.new item_params
    end
    end
    end
  4. smd686s created this gist Aug 23, 2013.
    1 change: 1 addition & 0 deletions Gemfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    gem "actionpack", "~> 4.0.0"
    2 changes: 2 additions & 0 deletions app.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    require 'rack/test'
    require 'action_controller/metal/strong_parameters'